niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Server
Calling stored procedures in c++ via odbc
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
harp
*nix forums beginner


Joined: 08 Feb 2005
Posts: 12

PostPosted: Thu Feb 10, 2005 5:49 pm    Post subject: Re: Calling stored procedures in c++ via odbc Reply with quote

If I do the following und sql*plus for e.g. I get the following:
Argument Name Typ In/Out
Defaultwert?
------------------------------ ----------------------- ------ --------
FIRSTNAME REF CURSOR IN/OUT
FAMILYNAME REF CURSOR IN/OUT
ADDRESS REF CURSOR IN/OUT
TELNO REF CURSOR IN/OUT
COMP VARCHAR2 IN

How can I define the types in my development environment (c++)?
It seems not to be recorgnized automatically.
Back to top
harp
*nix forums beginner


Joined: 08 Feb 2005
Posts: 12

PostPosted: Thu Feb 10, 2005 3:47 pm    Post subject: Re: Calling stored procedures in c++ via odbc Reply with quote

still in need of help....
is my problem so simple or not well described, still waiting for some
suggestions...
regards,
harp
Back to top
harp
*nix forums beginner


Joined: 08 Feb 2005
Posts: 12

PostPosted: Thu Feb 10, 2005 8:51 am    Post subject: Calling stored procedures in c++ via odbc Reply with quote

I have the following done in sql*plus

DROP PACKAGE ODBCRefCus;
CREATE PACKAGE ODBCRefCus AS
TYPE firstname_cus IS REF CURSOR;
TYPE familyname_cus IS REF CURSOR;
TYPE address_cus IS REF CURSOR;
TYPE telno_cus IS REF CURSOR;

PROCEDURE spEmpCus(Firstname IN OUT firstname_cus, Familyname IN OUT
familyname_cus, Address IN OUT address_cus, Telno IN OUT telno_cus,
comp IN
VARCHAR2);
END;
/

CREATE PACKAGE BODY ODBCRefCus AS
PROCEDURE spEmpCus(Firstname IN OUT firstname_cus, Familyname IN OUT
familyname_cus, Address IN OUT address_cus, Telno IN OUT telno_cus,
comp IN
VARCHAR2)
AS
BEGIN
IF NOT Firstname%ISOPEN
THEN
OPEN Firstname for SELECT firstname FROM customers WHERE
firm = comp;
END IF;
IF NOT Familyname%ISOPEN
THEN
OPEN Familyname for SELECT familyname FROM customers WHERE firm =
comp;
END IF;
IF NOT Address%ISOPEN
THEN
OPEN Address for SELECT address FROM customers WHERE firm = comp;

END IF;
IF NOT Telno%ISOPEN
THEN
OPEN Telno for SELECT telno FROM customers WHERE firm = comp;
END IF;
END;
END;
/
I was able to compile.
nd in my c++ program:
Assuming that all about the connections were okay
AnsiString stmt = "CALL ODBCRefCus.spEmpCus(?,?,?,?,'firm')";
//AnisString(borlands) is just a string
retcode =
SQLBindParameter(hstmt,1,SQL_PARAM_INPUT_OUTPUT,SQL_C_CHAR,SQL_C_CHAR,
sizeof(?),0,?,0,&firstnameId);
My problem is: what type do I use to bind for ? as parameters. If I use
AnsiString/string/char* - it gets problem with execution.
retcode = SQLExecute(hstmt);
And gives error message of ora-06553: pls-306 wrong number or type of
arguments.

NB: I do use oracle9i, c++builder6

I'm quite in need of your help.
Regards,
Harp
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 2:02 am | All times are GMT
navigation Forum index » Databases » Oracle » Server
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts Creating relational view for an ODBC result set? antilog@gmail.com Server 0 Fri Jul 21, 2006 5:56 am
No new posts How do I render JPEG Data stored in char* buffer? On the Sparrow C++ 2 Thu Jul 20, 2006 8:44 pm
No new posts calling stored procedure using ECPG Jasbinder Bali PostgreSQL 1 Thu Jul 20, 2006 7:53 pm
No new posts Error while calling an Oracle Stored Procedure from VB us... macca Server 5 Thu Jul 20, 2006 9:32 am

Facebook Proxy | PunBB forum hosting | Guitar Lesson | Power Rangers | Mortgage Calculator
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3748s ][ Queries: 20 (0.2157s) ][ GZIP on - Debug on ]