PowerBuilder 2019R2
Oracle 12C
Windows 10 64 bit platform, SP-1
Summary: What's wrong with the dynamic SQL below?
Details: When the SQL below was run, it generated the following error when the FETCH was executed:
SQL:
DECLARE my_cursor DYNAMIC CURSOR FOR SQLSA;
string ls_sql, ls_data
// Use the pk_column_name to get the next UID
ls_sql = 'SELECT MAX (' + ls_pk_column + ') FROM ' + as_tablename + "; "
// Process the dymanic sql
PREPARE SQLSA FROM :ls_sql USING SQLCA ;
OPEN DYNAMIC my_cursor ;
FETCH my_cursor INTO :UID ; <---- Error occurs on the FETCH
ll_rc = sqlca.sqlCode
IF (ll_rc = 0 AND NOT (IsNull (UID)) AND (UID > 0)) THEN
// Success
al_uid = UID + 1
lb_update_table_uid = TRUE
ELSE
MessageBox ("Get Next UID Error", "An error occurred while trying to " + &
"get the next UID for the table ~"" + as_tablename + "~".~r~n " + &
"~r~n sqlErrCode: " + string (sqlca.sqlCode) + &
"~r~n sqlErrText: " + sqlca.sqlErrText, StopSign!)
al_uid = 0
GOTO GOT_UID
END IF
CLOSE my_cursor ;
Thank You,
Olan
I removed the ";" from the end and it worked like a champ!
Later -