Link to home
Start Free TrialLog in
Avatar of basilhs_s
basilhs_s

asked on

powerbuilder , stored procedure, output parameters

i have created a stored procedure in sql server 2000 as follows  (only the parameters are included)

CREATE procedure sp_update_logist_01
 @scr_code_ph            nvarchar(08)
,@scr_date                                 datetime
,@scr_xwros            nvarchar(2)
,@scr_n_seira            nvarchar(2)
,@scr_parast            nvarchar(2)
,@scr_parast_no            decimal
,@scr_status            int  output

how can i execute this stored procedure from powerbuilder ? How can i receive the value of @scr_status which is an output parameter and store its value to a local int variable?
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

There are several ways...

If stored procedure is supposed to return multiple records (again... records not the columns)
for given input then i would recommend to create datawindow using that stored procedure and retrieve it.

Otherwise, create stored function instead of stored procedure.

Both stored procedure and stored functions can be also called as RPC.
1. create non-visual object of type Transaction
2. declare stored procedure or function as external function to it.
subroutine sp_update_logist_01(string var1,datetime var2, string var3,string var4,string var4, dec var5, ref integer var6) RPCFUNC ALIAS FOR "sp_update_logist_01"
(see pb help - 'Declaring DBMS stored procedures as remote procedure calls' for more detail)
3. change sqlca property to above transaction object in your application object.
Open applicaiton object > properties > general tab.. click additional properties > variable types tab... change sqlca value.
4. now you can call stored procedure from anywhere by
sqlca.sp_update_logist_01(arg1, arg2,....,arg6)
where arg6 is the result returned from procedure.

Regards,
Sandeep
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of basilhs_s
basilhs_s

ASKER

this is exactly what i want