BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Please help about to call DB2 store procedure and output pa

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Tom
Guest





PostPosted: Fri Sep 12, 2003 8:30 am    Post subject: Please help about to call DB2 store procedure and output pa Reply with quote



I have a question is
call a DB2 store procedure and want get output parameter,
but I don't know how to declare output parameter.
The example is
//--------------------------------
declare aa varchar(1)
call proc01(aa)
select aa as field01
//-------------------------------
and DB2 error message is SQL0104 --that's mean syntx error
So,can somebody help me to clear up it?
thank you..
Tom.



Back to top
Arnie Mauer
Guest





PostPosted: Fri Sep 12, 2003 1:59 pm    Post subject: Re: Please help about to call DB2 store procedure and output Reply with quote



"Tom" <tom (AT) dingey (DOT) com.tw> wrote

Quote:
I have a question is
call a DB2 store procedure and want get output parameter,
but I don't know how to declare output parameter.
The example is
//--------------------------------
declare aa varchar(1)
call proc01(aa)
select aa as field01
//-------------------------------
and DB2 error message is SQL0104 --that's mean syntx error
So,can somebody help me to clear up it?
thank you..
Tom.


We use query objects instead of stored procedure objects. Had some problems
with them. The SQL syntax for DB2 V8 is:

"CALL ProcName( :param1, ... )"

For DB2 V7, leave the parenthesis "( )" out.

Once you have set the SQL, you have to set the parameter's direction to
pdOutput. After executing the query, retrieve the value from the parameter.
Please excuse the C++ syntax:

// Set the SQL
q->SQL->Text = "CALL MyProc( Madx )";
// Set the direction
q->Parameters->ParamByName( "xx" )->Direction = pdOutput;
// Execute
q->ExecSQL();
// Retrieve the value
AnsiString xx = qin->Parameters->ParamByName( "xx" )->Value;

Good luck,

- Arnie




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.