Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning Rows from a Stored Procedure in Oracle...can it be done?
Yes but if you use a cursor how does a language such as VB using DAO, RDO
XXO etc.
access this returned cursor, as far as I can tell it isn't supported unless
you use
Oracle Object for OLE.
EdwardAwad_at_webtv.net wrote in message <716a39$vj9$1_at_nnrp1.dejanews.com>...
>In article <Z5oZ1.3860$mP.4239842_at_news.rdc1.ab.wave.home.com>,
> "Ryan Gallagher" <ryang_at_quadrus.com> wrote:
>> In MS SQL server, I am able to have a store procedure that returns a
result
>> set and use it Via ADO recordset. How do I do this in Oracle?
>>
>> Sample SQL server Code....
>> =======================
>> (For those of you who don't know MSSQL the last SQL Select statement in a
>> SQL statement will be returned as a dataset to ODBC)
>>
>> CREATE PROCEDURE spGetUsers(@UID INTEGER)
>> BEGIN
>>
>> /* Heres some sort of condition statement*/
>>
>> IF @UID > 10
>> BEGIN
>>
>> /*Return Users with UID < 10*/
>> SELECT UID,UserName FROM tblUser WHERE UID < @UID
>>
>> END
>> ELSE
>> BEGIN
>>
>> /*Return Users with UID > 10*/
>> SELECT UID,UserName FROM tblUser WHERE UID > @UID
>>
>> END
>>
>> END
>>
>> Sample ADO Code (in VB5)....
>> ===========================
>>
>> Dim dbCon As New ADODB.Connection
>> Dim RS As New ADODB.Recordset
>>
>> 'connect to the database
>> dbCon.Open "DSN=MyDB", "sa", ""
>>
>> 'Execute the SQL Statement
>> RS.Open "EXEC spGetUsers 23", dbCon, adOpenForwardOnly
>>
>> *This should fill the RS with the records returned by spGetUsers*
>>
>> Any help would be appreciated
>> (If possible, please Cc: me by email)
>>
>> Thanks
>> Ryan Gallagher
>>
>>
>Use Cursor variables.
>
>--
>Edward Awad
>Oracle Developer
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Wed Oct 28 1998 - 07:29:57 CST