2014-09-22 189 views
0

我正在從BW調用過程調用中調用DB2存儲過程。來自Tibco的DB2 SQL錯誤:SQLCODE = -952,> SQLSTATE = 57014 BW

當我在數據庫中測試這個過程,它得到正確執行。 但是當我通過BW把它拋出異常

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

我的存儲過程的代碼如下

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 

正如我研究,它被說,這是在DB2中斷代碼。 如何在DB2中處理這個問題

+0

這可能是由您的應用程序超時造成的。 – mustaccio 2014-09-22 15:18:50

+0

我給超時100秒,商店proc一般不佔用那麼多時間.max(40秒) – Fryder 2014-09-22 15:46:10

+0

什麼是DB2平臺?什麼版本? – user2338816 2014-09-23 07:02:08

回答

0

我將Tibco超時時間增加到了現在的6分鐘。
從12個表格中刪除2百萬個數據
感謝各位的幫助

相關問題