Re: cannot pass entire records to function in SQL command

From: Gerard H. Pille <ghp_at_skynet.be>
Date: Wed, 12 Jan 2011 16:58:36 +0100
Message-ID: <4d2dcfac$0$14253$ba620e4c_at_news.skynet.be>



Frank Bergemann wrote:
> Hi,
>
> i wonder why this doesn't work:
>
> --------------------- snip ----------------------------------------
>
> set serveroutput on
>
> drop table tabx;
> /
>
> drop table taby;
> /
>
> create table tabx (
> a number,
> b number
> );
> /
>
> create table taby (
> a number,
> b number
> );
> /
>
> drop function func;
> /
>
> create function func(rec in tabx%rowtype)
> return number
> is
> begin
> return 1;
> end;
> /
>
> declare
> begin
> for i in 1..1000 loop
> insert into tabx values (i, i);
> insert into taby values (i, i);
> end loop;
> commit;
>
> select rec.a, func(rec)
> from tabx rec;
>
> end;
> /
>
> --------------------- snap ----------------------------------------
>
> i get:
> select rec.a, func(rec)
> *
> ERROR at line 9:
> ORA-06550: line 9, column 21:
> PL/SQL: ORA-00904: "REC": invalid identifier
> ORA-06550: line 9, column 2:
> PL/SQL: SQL Statement ignored
>
>
> Why is it not possible to pass the whole record to a function?
>
> - thanks!
>
> rgds,
> Frank

and if you try func(rec.*) ? Received on Wed Jan 12 2011 - 09:58:36 CST

Original text of this message