Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

return value from execute immediate

539 views
Skip to first unread message

veenita

unread,
Feb 23, 2004, 9:07:31 PM2/23/04
to
Hello

I have a sproc which returns a value . Now in the
powerbuilder I want to execute immediate the sproc.So how
can I get the return value ?for eg:
String s = "execute SP_Sample '" + paramtername +"'"
Execute Immediate : s;

So how I can I get the return value of the sproc?

Thanks in advance!!!!
veenita

Paul Horan[TeamSybase]

unread,
Feb 23, 2004, 10:40:42 PM2/23/04
to
Why use execute immediate? There's no need to...
I typically link a datawindow to a stored proc, and then all I have to do is call Retrieve().


--
Paul Horan[TeamSybase]

<veenita> wrote in message news:403ab1ed.23...@sybase.com...

steve_katz[teamsybase]

unread,
Feb 24, 2004, 10:32:00 AM2/24/04
to
If the procedure doesn't have a result set but has a return
value and/or output parms, use an RPCFunc instead, passing
output parms by reference. The return value of the RPCFunc
is the stored procedure return value.

If your procedure has both a result set and return value,
using the proc as a dw source is not an option because the
return value will be lost unless you include the return
value as an "appended" column to the result set.

If you don't want to append the return value, you can use
the declare/execute syntax instead to call the procedure.
The return parm is the first value in the row returned in
the second result set. Basically, you would execute, then
fetch the result set. When you get SQLCode = 100, fetch one
more time into the variable to hold the return value. If
you also have output parms, they follow as columns in that
single additional fetch in the order they were declared in
the procedure.

steve
[TeamSybase]

0 new messages