Re: cannot pass entire records to function in SQL command

From: Thomas Olszewicki <ThomasO_at_cpas.com>
Date: Wed, 12 Jan 2011 06:25:32 -0800 (PST)
Message-ID: <171fdb3d-758a-43dd-bdcc-81f08f92cae5_at_p8g2000vbs.googlegroups.com>



>>Why is it not possible to pass the whole record to a function? <<
It is, but you are not passing a record to your function. In your code "rec" is an alias for the table tabx and not a record. Second problem, in Pl/Sql block you cannot just use "select...". You must use cursor or "select...into".
Change your code to:

declare

   sRec tabx%rowtype;
begin

        for i in 1..1000 loop
                insert into tabx  values (i, i);
                insert into taby  values (i, i);
        end loop;
        commit;


        select * into sRec from tabx where a=1; make sure this select
fetches only one row.
        func( sRec);

end;

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/fundamentals.htm#sthref394
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/overview.htm#sthref169
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm

HTH
Thomas Received on Wed Jan 12 2011 - 08:25:32 CST

Original text of this message