When a stored procedure is executed using dynamic SQL and the result set contains 0 data row, SQLCode property returns 100 in PowerBuilder but returns 0 (when only one column is returned) or -1 (when more than one column is returned) in PowerServer.
In the following example, table pshelp_sqlcode
has
no data, and sqlcode
returns -1 in PowerServer.
Stored procedure:
CREATE PROCEDURE [dbo].[ps_pro] AS BEGIN SELECT name,age FROM pshelp_sqlcode; END
PowerScript:
String ls_name Long ll_age PREPARE SQLSA FROM "execute ps_pro"; DECLARE pro DYNAMIC PROCEDURE FOR SQLSA ; EXECUTE DYNAMIC pro ; DO WHILE SQLCA.SQLCode =0 FETCH pro INTO :ls_name,:ll_age; //SQLCode returns -1 in PS and 100 in PB MessageBox("",SQLCA.SQLCode) LOOP CLOSE pro ;