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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Get values from REF CURSORS in Stored Procedures

Re: Get values from REF CURSORS in Stored Procedures

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 02 Jul 2002 21:16:25 +0200
Message-ID: <guu3iukeui8m1lvhcf5ajp6v8cd0gf5hjk@4ax.com>


On 2 Jul 2002 01:28:59 -0700, teoman.ayan_at_contakt.net (teoman) wrote:

>I want to know how can I get the values from ref cursors in stored procedures?
>I give a little example:
>
>create or replace procedure mytest(ReturnCursor in out ref_cursor.mycursor,
>"PART_NUMBER" in Varchar2) is
>p_part_number varchar2(40) := "PART_NUMBER";
>sqltext varchar2(2000);
>begin
>sqltext := 'select * from product where part_number = '''|| p_part_number||'''';
>open returncursor for sqltext;
>end mytest;
>
>If i want use the procedure like this
>
>declare
>myc ref_Cursor.mycursor;
>cursor cr
>is
>select * from product;
>rec cr%rowtype;
>begin
>mytest(myc,'PAT-LIC-ADL');
>fetch myc into rec;
>dbms_output.put_line(rec.DESCRIPTION);
>end;
>
>thats ok. But I don't have in all cases the cursor definition. I need "variant"
>variables or something like that. How can i manage it?

simply define the type as REF CURSOR, which implies a weakly typed cursor and can return anything

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Tue Jul 02 2002 - 14:16:25 CDT

Original text of this message

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