Table Function error: wrong number or types of arguments

From: KevinS <SearleK_at_googlemail.com>
Date: Tue, 26 May 2009 07:42:21 -0700 (PDT)
Message-ID: <0a3a46f9-e2ba-4679-ac4f-ce89929ba28f_at_o14g2000vbo.googlegroups.com>



Hi All,

I am developing an application in Oracle 10.2.0.3.0.

This is my first attempt at using Table functions.

The code below is giving me the error

        Errors for FUNCTION TABLEFUNCTION:

	LINE/COL ERROR
	--------
-----------------------------------------------------------------
	18/11    PL/SQL: Statement ignored
	18/21    PLS-00306: wrong number or types of arguments in call to
'TAB'
	18/21    PLS-00306: wrong number or types of arguments in call to
'TAB' Can anyone tell me what I am doing wrong?

thanks

	drop table TABLE_A;
	drop table TABLE_B;
	drop function tablefunction;
	drop type tab;
	drop type ntt;

	create table TABLE_A
	(
	  COL_AA INTEGER not null,
	  COL_AB VARCHAR2(2000) not null,
	  COL_AC VARCHAR2(30),
	  COL_AD INTEGER not null,
	  COL_AE TIMESTAMP(6) not null
	)

/
create table TABLE_B ( COL_BA INTEGER not null, COL_BB VARCHAR2(50), COL_BC INTEGER not null, COL_BD VARCHAR2(1000) not null )
/
CREATE OR REPLACE TYPE ntt AS OBJECT ( x INTEGER, y VARCHAR2(2000) )
/
CREATE OR REPLACE TYPE tab AS TABLE OF ntt
/
CREATE OR REPLACE FUNCTION tablefunction RETURN tab PIPELINED IS rt_a table_a%ROWTYPE; my_ntt tab; CURSOR my_cur IS SELECT * FROM table_a; BEGIN OPEN my_cur; LOOP FETCH my_cur INTO rt_a; EXIT WHEN NOT my_cur%FOUND; PIPE ROW (tab(rt_a.col_aa, rt_a.col_ab)); END LOOP; CLOSE my_cur; RETURN; END tablefunction;
/
Received on Tue May 26 2009 - 09:42:21 CDT

Original text of this message