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 -> Re: PL/SQL - returning RECORD from function

Re: PL/SQL - returning RECORD from function

From: D. Buecherl <Buecherl_at_nkk.net>
Date: Thu, 15 Apr 1999 11:46:56 +0100
Message-ID: <3715C3A0.9D9EA812@nkk.net>


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

Original text of this message

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