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: Returning Rows from a Stored Procedure in Oracle...can it be done?

Re: Returning Rows from a Stored Procedure in Oracle...can it be done?

From: <EdwardAwad_at_webtv.net>
Date: Wed, 28 Oct 1998 05:29:13 GMT
Message-ID: <716a39$vj9$1@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 Tue Oct 27 1998 - 23:29:13 CST

Original text of this message

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