I have a stored procedure in SQL Server:
CREATE PROCEDURE [GROUP1].[test_return]( @OUTVALUE integer OUT ) AS
begin
SET @OUTVALUE = 999999;
RETURN
end
In Powerbuilder, I've set up a DECLARE and EXECUTE statement:
long ll_result
DECLARE test_result PROCEDURE FOR group1.test_return @OUTVALUE = :ll_result OUTPUT;
EXECUTE test_result;
MESSAGEBOX('RESULT','Test OUTPUT: ' + string(ll_result) + CHAR(13) + CHAR(10) + sqlca.sqlerrtext, StopSign!)
--------
...And my result is always 0 with sqlerrtext reporting: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Error converting data type varchar to int
I am using Powerbuilder 2022 R2 build 2819 and SQL Server 2022
The workaround is to put a local external function call in the n_trans object like so:
function long test_return(ref long OUTVALUE) RPCFUNC ALIAS FOR "group1.test_return"
But I shouldn't have to do this. This is a bug.