- Vincent Ma
- PowerBuilder
- Monday, 14 October 2019 07:34 AM UTC
I have tried a sample test for calling stored procedure in PB 2017.
Tested SP as below
create procedure sp_vm_test
@in_parm varchar(10),
@out_parm varchar(20) output
as begin
set @out_parm = @in_parm + ' return from SP'
end
Coding in PB as below
string ls_in_parm, ls_out_parm
ls_in_parm = "Hello"
ls_out_parm = ""
declare proc_vm procedure for sp_vm_test
@in_parm = :ls_in_parm,
@out_parm = :ls_out_parm OUTPUT
using SQLCA;
execute proc_vm;
if (SQLCA.SQLCODE 0 and SQLCA.SQLCODE 100) then
Messagebox("Debug", "SQLCODE = " + String(SQLCA.SQLCODE) + " SQLErrTest = '" + SQLCA.SQLErrText + "'")
else
fetch proc_vm into :ls_out_parm;
Messagebox("Debug", ls_out_parm)
end if
close proc_vm;
If I run it by deploying to Appeon server. Prompted message is
Hello return from SP
However, if same source runs in source locally. below message is prompted.
SQLCODE = -1 SQLErrTest = 'SQLSTATE = 42000 Microsoft SQL Server Native Client 11.0 Cannot use the OUTPUT option when passing a constant to a stored procedure.'
Please advise.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.