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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: ref cursor question

Re: ref cursor question

From: Edgar Chupit <chupit_at_gmail.com>
Date: Wed, 28 Nov 2007 11:49:53 +0100
Message-ID: <a8f0771c0711280249w2780ce72yd4d722b02805f0b3@mail.gmail.com>


Hi Ryan,

The problem is, that you can only fetch row from the database. In case of ref_cursor you have to fetch complete row, so you have to have variable where to put all columns.
Previously in such a cases, I've used method similar to what David has described. The biggest advantage of this approach is that you will have "strong" refcusor instead of weak refcursor: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1409, so Oracle can check if your query matches your specification during parsing.
If you don't want to use this approach, you can write small java stored procedure, that can fetch from ref cursor and use this procedure from pl/sql.
Luckily in 11g you can convert ref cursor into dbms_sql cursor id and write a procedure that can fetch rows from any cursor using dbms_sql functions.

For unit tests I've used java stored procedure approach, but I don't have procedure code at my hand right now to show you as example. If you still need the java procedure to fetch from ref cursor, I can send it to you this evening.

Just my 2 cents.

On Nov 28, 2007 1:02 AM, <ryan_gaffuri_at_comcast.net> wrote:
> I am returning REF Cursors to an external interface. I want code to test each of these procedures. The problem is that these queries often have 25+ columns in them from several tables.

-- 
Best regards,
 Edgar Chupit
 callto://edgar.chupit
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 28 2007 - 04:49:53 CST

Original text of this message

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