Skip to Content
0
Former Member
Feb 16, 2016 at 08:46 PM

SQL Anywhere - How get OUT-parameters of stored functions in PB

724 Views

Hi,

is it possible to get the out-Parameters of a sp (SQL Anywhere) in Powerbuilder?

He read something about indicating that :ls_output is an OUTPUT variable (**OUTPUT**), but that does't work.

Here is my test code:

PB:

string ls_input,ls_output,ls_errormsg,ld_sequenceno

ls_input = 'ABC'

//Declaration

Declare proc_example Procedure for test_proc

in_value = :ls_input,

out_value = :ls_output

using sqlca;

//Execution

Execute proc_example;

If Sqlca.Sqlcode <> 0 Then

ls_errormsg = Sqlca.SQLErrText

Rollback Using Sqlca;

MessageBox( 'Error', 'Error: ' + ls_errormsg , Stopsign! )

Return

End If

// Fetch

Fetch proc_example Into :ls_output;

If Sqlca.Sqlcode <> 0 Then

ls_errormsg = Sqlca.SQLErrText

Rollback Using Sqlca;

MessageBox( 'Error', 'Error2: ' + ls_errormsg , Stopsign! )

Return

End If

messagebox("ls_input",ls_input)

messagebox("ls_output",ls_output)

SQL Anywhere:

ALTER PROCEDURE "admin"."test_proc"( in in_value varchar(100),out out_value varchar(100) )

begin

set out_value = in_value+' OK'

end

Thanks 😊