Home » SQL & PL/SQL » SQL & PL/SQL » cursor as a parameter in Stored Procedure??
cursor as a parameter in Stored Procedure?? [message #36462] Thu, 29 November 2001 01:39 Go to next message
G Sreenivasulu Naidu
Messages: 1
Registered: November 2001
Junior Member
Hi,
How to pass cursor as OUT parameter in the Stored procedure in Pl/SQL..i need this info urgently..
Pls send any information if u have regarding this ....

Thanks advance..
G Sreenivasulu Naidu

----------------------------------------------------------------------
Re: cursor as a parameter in Stored Procedure?? [message #36467 is a reply to message #36462] Thu, 29 November 2001 03:16 Go to previous messageGo to next message
SAlapati
Messages: 12
Registered: November 2001
Junior Member
Please read the documentation on REF CURSOR

----------------------------------------------------------------------
Re: cursor as a parameter in Stored Procedure?? [message #36470 is a reply to message #36462] Thu, 29 November 2001 04:46 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
step 1:
create ref cursor in package (global)

CREATE OR REPLACE PACKAGE sample IS
TYPE gen_cur IS REF CURSOR ;
END;
/
Step 2:
CREATE OR REPLACE PROCEDURE sample_proc(p_retcur OUT sample.gen_cur) IS
l_strquery varchar2(2000);
BEGIN
l_strquery := 'select * from tablename';
OPEN p_retcur FOR l_strquery;
end;

when you call above procedure, it will return output as resultset.

----------------------------------------------------------------------
Previous Topic: how to write a file with PL/SQL
Next Topic: How to Insert a Recordset object using stored procedures.
Goto Forum:
  


Current Time: Sun Mar 29 23:50:30 CDT 2020