I am trying to implement a generic db2 stored procedure which will take parameters like tablename, where condition and will perform delete using cursor and will do commits baesd on commit frequency passed as parameter.
I have coded the below procedure, i am getting SQLCODE as -510 - THE TABLE DESIGNATED BY THE CURSOR OF THE UPDATE OR DELETE STATEMENT CANNOT BE MODIFIED.
I am not sure what I am missing here. Can you please help me out?
CREATE PROCEDURE XXXXX.DELETE_WITH_COMMIT_COUNT
( IN v_TABLE_NAME VARCHAR(50),
IN v_COMMIT_COUNT INTEGER,
IN v_WHERE_CONDITION VARCHAR(1024),
OUT v_SQLCODE INTEGER,
OUT v_SQLSTATE CHAR(05),
OUT v_ERROR_TXT VARCHAR(1000),
OUT v_ROWS_DELETED INTEGER,
OUT v_DELETE_QUERY VARCHAR(2000)
MODIFIES SQL DATA
DYNAMIC RESULT SETS 0
ALLOW DEBUG MODE
PACKAGE OWNER XXX
WLM ENVIRONMENT FOR DEBUG MODE XXXXXX
ISOLATION LEVEL CS