Re: REF CURSOR with Perl DBI

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 10 Mar 2002 17:44:17 -0800
Message-ID: <a6h25h02u3k_at_drn.newsguy.com>


In article <0f7n8ugf9ha7e40av0uiuo8l50ajonmllj_at_4ax.com>, Lee says...
>
>Some people posting here seem to have some experience with the Perl
>DBI and oracle.
>
>Will the perl DBI support Oracle's REF CURSOR . I'ld like to call a
>pl/sql stored procedure which returns a ref cursor as an output
>argument. Imaging a package interface like:
>
><never mind the pre-amble, create pacakge blah .....>
>TYPE ref_Cursor_type is REF CURSOR
>
>sum_proc( i_arg1 IN varchar2,
> .... ,
> i_argn IN varchar2,
> o_results OUT ref_cursor_type);
>-- -------------------------------------------------------------
>-- Takes n input args, returns one ref cursor with lets say 3 varchar2
>-- cols, (colA, colB, col C )
>-- --------------------------------------------------------------
><end of snippet>
>
>Now I want to call this from perl, binding some perl variable to
>i_arg1 thru i_argn and accepting o_result back.
>
>Then of course, I want to fetch all the individual rows from o_result,
>and put the cols of o_result into local variables ($a, $b, $c ) ,
>either one row at a time, or as an array bind (but thats a nice-to,
>not a must-to).
>
>Any hope? (sample code would be nice),
>
> If not, what do people use as a workaround? I suppose I could always
>have the packaged procedure dump stuff into a "result" table and then
>have perl select the cols of the result table. Crude, but it would do
>the job.
>
>

See
http://osi.oracle.com/~tkyte/ResultSets/index.html

I've collected examples for
 SQLPlus, Pro*C, Java/JDBC, ODBC, ADO/ASP, DBI Perl and OCI

--
Thomas Kyte (tkyte_at_us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Mon Mar 11 2002 - 02:44:17 CET

Original text of this message