sqlstored-proceduresdb2businessworks

DB2 SQL Error: SQLCODE=-952, > SQLSTATE=57014, from Tibco BW


I am calling a DB2 stored proc from BW call procedure pallet.

when i test this proc in database ,it is getting executed properly. But when i call through BW it throws exception

JDBC error reported: (SQLState = 57014) - com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-952, SQLSTATE=57014, SQLERRMC=null,

My stored proc's code is as below

CREATE OR REPLACE PROCEDURE TABLE1_PURGE_PROC_V1 (IN v_REF_VERSION VARCHAR(3), OUT o_DELTETE_STATUS VARCHAR(7))
    P1: BEGIN

    --DECLARE v_TABLE_NAME VARCHAR(30);
    DECLARE v_WHERE_CONDITION VARCHAR(1024);
    DECLARE V_COUNT_QUERY VARCHAR(1024);
    DECLARE v_COMMIT_COUNT INTEGER;

    SET v_WHERE_CONDITION='REF_VERSION ='||v_REF_VERSION;
    SET v_COMMIT_COUNT=10000;


    CALL SCHEMA.DELETE_WITH_COMMIT_COUNT('SCHEMA.TABLE1',v_COMMIT_COUNT,v_WHERE_CONDITION);
    CALL SCHEMA.DELETE_WITH_COMMIT_COUNT('SCHEMA.TABLE2',v_COMMIT_COUNT,v_WHERE_CONDITION);
    CALL SCHEMA.DELETE_WITH_COMMIT_COUNT('SCHEMA.TABLE3',v_COMMIT_COUNT,v_WHERE_CONDITION);
    CALL SCHEMA.DELETE_WITH_COMMIT_COUNT('SCHEMA.TABLE4',v_COMMIT_COUNT,v_WHERE_CONDITION);


    INSERT INTO SCHEMA.DEBUG_LOG(PROC_NAME,LOG_TIME,MESSAGE) VALUES('TABLE1_PURGE_PROC_V1',CURRENT_TIMESTAMP,'ALL TABLE1 RELATED TABLES INVALID DATA DELETED FOR VERSION-'||v_REF_VERSION);

    SET o_DELTETE_STATUS ='SUCCESS';
    END P1 

    ####################################### PROC 2 ###########################################################
    CREATE OR REPLACE PROCEDURE DELETE_WITH_COMMIT_COUNT(IN v_TABLE_NAME VARCHAR(24), IN v_COMMIT_COUNT INTEGER, IN v_WHERE_CONDITION VARCHAR(1024))
        NOT DETERMINISTIC
        LANGUAGE SQL
    P1: BEGIN
     -- DECLARE Statements
        DECLARE SQLCODE INTEGER;
        DECLARE v_DELETE_QUERY VARCHAR(1024);
        DECLARE v_DELETE_STATEMENT STATEMENT;


        SET v_DELETE_QUERY = 'DELETE FROM (SELECT 1 FROM ' || v_TABLE_NAME || ' WHERE ' || v_WHERE_CONDITION
            || ' FETCH FIRST ' || RTRIM(CHAR(v_COMMIT_COUNT)) || ' ROWS ONLY) AS DELETE_TABLE';

        PREPARE v_DELETE_STATEMENT FROM v_DELETE_QUERY;


        DEL_LOOP:
            LOOP
                EXECUTE v_DELETE_STATEMENT;
                IF SQLCODE = 100 THEN
                    INSERT INTO TEP.DEBUG_LOG(PROC_NAME,LOG_TIME,MESSAGE) VALUES('DELETE_WITH_COMMIT_COUNT',CURRENT_TIMESTAMP,'ALL DATA DELETED FROM'||v_TABLE_NAME||'QUERY USED IS'||v_DELETE_QUERY);
                    LEAVE DEL_LOOP; 
                END IF;
                COMMIT;
            END LOOP;   
        COMMIT;
    END P1 

As I researched ,it is being said that it is the interruption code in DB2. How to handle this in DB2


Solution

  • I added Tibco timeout to 6 minutes its working now.
    deleting 2 million data from 12 tables
    Thanks guys for helping