 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tom Guest
|
Posted: Fri Sep 12, 2003 8:30 am Post subject: Please help about to call DB2 store procedure and output pa |
|
|
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
|
Posted: Fri Sep 12, 2003 1:59 pm Post subject: Re: Please help about to call DB2 store procedure and output |
|
|
"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( x )";
// 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 |
|
 |
|
|
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
|
|