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 » IBM DB2
calling stored procedures via oracle odbc
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
dotyet
*nix forums addict


Joined: 06 Jul 2005
Posts: 55

PostPosted: Tue Feb 08, 2005 12:12 pm    Post subject: Re: calling stored procedures via oracle odbc Reply with quote

wrong group!!

post your query here

http://groups-beta.google.com/group/comp.databases.oracle.server

regards,
dotyet
Back to top
Harp
*nix forums beginner


Joined: 01 Mar 2005
Posts: 2

PostPosted: Tue Feb 08, 2005 11:43 am    Post subject: calling stored procedures via oracle odbc Reply with quote

I created a stored procedure in oracle with the help of sql +plus:

Set serveroutput on
create or replace procedure spComp(company IN CHAR,oFname OUT CHAR,
oFamname OUT CHAR, oAdr OUT CHAR, oTelno OUT CHAR)

AS

Cursor SelWorkers IS
SELECT
firstname, familyname, address, telno
FROM customers
WHERE company = 'Compname';

cnt NUMBER DEFAULT 1;

BEGIN
DBMS_OUTPUT.PUT_LINE('Employees of Companyname');
DBMS_OUTPUT.PUT_LINE('firstname familyname address telno');
FOR customers IN SelWorkers LOOP
oFname := customers.firstname;
oFamname := customers.familyname;
oAdr := customers.address;
oTelno := customers.telno;
cnt := cnt + 1;
DBMS_OUTPUT.PUT_LINE(customers.firstname||' :
'||customers.familyname||' : '||customers.address||' :
'||customers.telno);
END LOOP;
END spComp;
/

DECLARE
oFname CHAR(15);
oFamname CHAR(15);
oAdr CHAR(20);
oTelno CHAR(7);
BEGIN
spComp('Companyname',oFname,oFamname,oAdr,oTelno);
END;
/
The results were okay.
Now I am trying to call it via odbc.
All about connections were okay.

AnsiString stmt = "CALL
spComp('Companyname',firstname,familyname,address,telno)";
ret = SQLAllocStmt(hDBconn, &hstmt);//locate the statement ok
ret = SQLExecDirect(hstmt, stmt.c_str(), SQL_NTS);

immediately I step in here trying to execute, I get ret delivers -1
is there any tricks I am missing? Also bei Prepare, same problem. If I
just use normal sql-stament, it works fine.
How can I call this procedure well?

I am using C++Builder6 as my developing environment, Oracle9i.

Thanks in advance,
Harp
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 2:56 am | All times are GMT
navigation Forum index » Databases » IBM DB2
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 Move Oracle 10g database to another location Selt Server 0 Fri Jul 21, 2006 2:14 pm
No new posts Oracle runtime Spitfire Server 0 Fri Jul 21, 2006 1:18 pm
No new posts Oracle Text Score Computation jatinder.1975@gmail.com Server 0 Fri Jul 21, 2006 1:00 pm
No new posts Creating relational view for an ODBC result set? antilog@gmail.com Server 0 Fri Jul 21, 2006 5:56 am

Debt Consolidation | Mortgage Calculator | Credit Cards | Mobile Phone | Myspace Layouts
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.1339s ][ Queries: 20 (0.0631s) ][ GZIP on - Debug on ]