Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL - returning RECORD from function
Is it necessary to declare a TYPE?
wouldn't the following code work just fine ?
CREATE OR REPLACE FUNCTION GetARow RETURN lt_menu%ROWTYPE
IS
CURSOR cur_myRec IS
SELECT * FROm lt_menu;
rec_myrec cur_myRec%ROWTYPE;
BEGIN
OPEN cur_myRec;
FETCH cur_myRec INTO rec_myrec;
CLOSE cur_myRec;
return rec_myrec;
END GetARow;
/
set serveroutput on;
DECLARE row_found lt_menu%ROWTYPE;
BEGIN
row_found := GetARow;
dbms_output.put_line(row_found.ID_lt_menu);
END;
Dieter
NewName_at_mel.switch.net.au schrieb:
> ....
>
> 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 Thu Apr 15 1999 - 05:46:56 CDT