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: ref_cursor was (Sybase vs Oracle)?

Re: ref_cursor was (Sybase vs Oracle)?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/12/02
Message-ID: <366ac49d.4572595@192.86.155.100>#1/1

A copy of this was sent to Joe & Anne Buhl <jabuhl_at_worldnet.att.net> (if that email address didn't require changing) On 2 Dec 1998 04:36:56 GMT, you wrote:

>First I called 5 experienced Oracle DBA's and only one had ever used Ref Cursors.
>She only described them to me as "not pretty".
>

well, most dba's I know do not write application code -- why would they know about it?

secondly - since most processing that needs to be done in fact can be done by pl/sql (as opposed to some other language), why use ref cursors to return result sets -- the processing can and is done on the server.

>Then I popped out the PL/ SQL book and tried my luck. After an hour I now understand
>why the other 4 DBAs have never utilized this feature.
>

elaborate please? what was hard about them? I mean, to write a simple routine and use this in sqlplus to return a result set, all it takes is:

SQL> create procedure show_emps( p_cur in out types.refCur )   2 as
  3 begin
  4 open p_cur for select * from emp;   5 end;
  6 /

Procedure created.

SQL> variable x refcursor
SQL> exec show_emps( :x );

PL/SQL procedure successfully completed.

SQL> print x;

ENAME SAL DEPTNO
---------- ---------- ----------
SMITH 800 20
....

it really it quite simple... its not any harder in pro*c or oci (in fact, the pro*c or oci to deal with ref cursors is easier to write then code that declares its own cursors)...

>joe

[snip]

>> [snip]
>>
>> >
>> >I have not seen any third party tools or even Oracle tools that take advantage
>> >of ref_cursors. for instance in dbArtisan and Sybase you can excute a proc and
>> >your results are there. You do that in Oracle from db artisan and ...........
>> >
>>
>> Some Oracle tools:
>>
>> - sqlplus
>> - svrmgrl
>> - FORMS
>>
>> Some Non Oracle tools:
>>
>> - Crystal reports
>> - netscapes web api stuff
>> - powerbuilder
>>
>> and there are more in both catagories. Its a feature that has been part of
>> Oracle since 7.2 -- sorry the exact tool you are using did not choose to support
>> it. Its very each to use.
>> >joe

[snip]  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/    -- downloadable utilities
 
----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation
 
Anti-Anti Spam Msg: if you want an answer emailed to you, 
you have to make it easy to get email to you.  Any bounced
email will be treated the same way i treat SPAM-- I delete it.
Received on Wed Dec 02 1998 - 00:00:00 CST

Original text of this message

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