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: Calling Oracle stored procedure from VC++

Re: Calling Oracle stored procedure from VC++

From: Roy Fine <rlfine_at_sfa2000.com>
Date: Fri, 1 Mar 2002 15:23:53 -0500
Message-ID: <ONHLs7VwBHA.1816@tkmsftngp07>


Knut,

Oracle can return a recordset - it must be declared as ref cursor in the stored procedure, and you must set the PLSQLRecset Property of the Command Object to TRUE (I am assuming that you would use the Command object with Parameters to pass to the SP).. Have a look at the Oracle OLEDB Client documentation - it should be on the PC when/where Oracle client is installed.

Reply back here if you don't have it - and I can give you some sample code.

best regards,
Roy Fine

"Knut Hovda" <knut.hovda_at_pti.no> wrote in message news:UNMf8.142$5vh.171024384_at_news.telia.no...
> Hello,
>
> I'm using VC++ 6.0 with MFC ODBC classes to access data in Oracle 8.1.6.
>
> The problem is calling stored procedures in Oracle that returns data. From
> what I have seen on previous postings, Oracle stored procedures can't
return
> recordsets (like stored procedures in SQL Server can), but for now I'd be
> happy to just be able to get some return parameters back to VC++.
>
> The MSDN article "Recordset: Declaring a Class for a Predefined Query
> (ODBC)" gives an example on how to build the recordset with the needed
> parameters, but the article says nothing if this is meant to work with
> Oracle, or if it is SQL Server only. Also, there are no examples on how
the
> stored procedure would look.
>
> An example: If I have the Oracle stored procedure (PL/SQL code):
>
> CREATE OR REPLACE PROCEDURE sp_get_zonename
> (v_zone_id IN zone.z_id%TYPE,
> v_zone_name OUT zone."ZoneName"%TYPE)
> IS
> BEGIN
> SELECT "ZoneName"
> INTO v_zone_name
> FROM zone
> WHERE Z_ID = v_zone_id;
> END;
> /
>
> how can I call this procedure from VC++ and get the variable v_zone_name
> back?
>
> In advance, thanks for your help.
>
> Regards,
>
> Knut
> --
> Knut Hovda (knut.hovda_at_pti.no)
> PTI Scandpower AS
> P.O.Box 206 / Billingstadsletta 30
> 1396 Billingstad, Norway
> Phone +47 66 85 03 21
>
>
Received on Fri Mar 01 2002 - 14:23:53 CST

Original text of this message

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