我从BW调用过程托盘调用DB2存储过程。
当我在数据库中测试此proc时,它正在正确执行。 但是当我通过BW调用它会抛出异常
报告的JDBC错误:(SQLState = 57014) - com.ibm.db2.jcc.am.SqlException:DB2 SQL错误:SQLCODE = -952, SQLSTATE = 57014,SQLERRMC = null,
我存储的proc代码如下
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 :(得分:2)
我将Tibco超时添加到现在的6分钟
从12个表中删除200万个数据
谢谢大家的帮助