I have an SP in Netezza to do UPSERTS between two tables by using a composite key .
It Compiles Correctly but then throws this error :
ERROR: unexpected transaction command in exec_stmt_execsql() - not allowed in stored procedure
DECLARE USERINPUT ALIAS FOR $1; ...... BEGIN DELETE FROM MAIN_TABLE WHERE TMS_NETWORK_ID||TMS_PROGRAM_ID IN (SELECT TMS_NETWORK_ID||TMS_PROGRAM_ID FROM T_F_SPLIT_PROG_SCHEDULE_STG) AND RUN_ID = USERINPUT ; INSERT INTO MAIN_TABLE SELECT FROM STAGING_TABLE WHERE RUN_ID = USERINPUT AND DEL_FLAG = 0;
..... END;
It seems i m trying something that isnt allowed in Netezza SP's , but i dont know what is causing the error. Please Help...??