Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> PL/SQL - returning RECORD from function

PL/SQL - returning RECORD from function

From: <NewName_at_mel.switch.net.au>
Date: Sat, 10 Apr 1999 05:23:40 GMT
Message-ID: <01be8310$88f7a900$38a320cb@default>


I have the following function declared and this works fine.

FUNCTION GetARow RETURN table_row IS

TYPE table_row IS RECORD (rec lt_menu%ROWTYPE); row_found table_row;

CURSOR c IS
  SELECT * FROM lt_menu;
BEGIN
 OPEN c;
   FETCH c INTO row_found.rec;
 CLOSE c;
 RETURN row_found;
END; But how do I call it .. I've tried the variations following without success

DECLARE TYPE table_row IS RECORD (rec lt_menu%ROWTYPE); row_found table_row;
menu_description lt_menu.menu_description%TYPE;

BEGIN row_found.rec := GetARow; -- expression is of wrong type row_found.rec := GetARow.rec; -- subprogram GETAROW reference is out of range
row_found := GetARow; -- expression is of wrong type   

END; If I include a dummy parameter in the function and call, then the following works fine :

row_found.rec := GetARow( '' ).rec ;

But even though the Oracle doco I've seen recommends that "if no parameters are required, then declare a local user-defined record to which you can assign functionresult and then reference the fields directly", I'm at a loss to know
how???



Brian Membrey Received on Sat Apr 10 1999 - 00:23:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US