Re: Table Function error: wrong number or types of arguments

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Tue, 26 May 2009 17:05:21 +0200
Message-ID: <4a1c052d$0$21386$426a74cc_at_news.free.fr>


"KevinS" <SearleK_at_googlemail.com> a écrit dans le message de news: 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;
| /

You must pipe a NTT type.

regards
Michel Received on Tue May 26 2009 - 10:05:21 CDT

Original text of this message