DB2 - Problem description
Problem IC64012 | Status: Closed |
SQLCODE -1224 FROM TRIGGER OR IF STATEMENT UNDER CERTAIN CONDITIONS | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
SQL1224N may result when the condition in a trigger WHEN clause or an IF statement references both: 1. an SQL scalar or row function 2. a subquery Example: CREATE TABLE PARTITION ( ID INT NOT NULL, STATUS SMALLINT NOT NULL, LOAD_ID INT NOT NULL ) CREATE TABLE DOMAIN ( PROPERTY VARCHAR ( 32 ) NOT NULL, NAME VARCHAR ( 32 ) NOT NULL, CODE SMALLINT NOT NULL ) CREATE FUNCTION GET_PROPERTY(p VARCHAR(32), s VARCHAR(32)) RETURNS INT READS SQL DATA DETERMINISTIC RETURN SELECT domain.code FROM domain WHERE domain.property = p AND domain.name = s CREATE FUNCTION GET_STATUS(s VARCHAR(32)) RETURNS INT READS SQL DATA DETERMINISTIC RETURN GET_PROPERTY('STATUS', s) CREATE TRIGGER RECORD_HISTORY AFTER UPDATE OF STATUS ON PARTITION REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN (((N.status = get_status('STORED'))) AND ((SELECT COUNT(*) FROM partition)=0) ) BEGIN END update partition set status = get_status('STORED') where id = 562126 DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1224N The database manager is not able to accept new requests, has terminated all requests in progress, or has terminated your particular request due to an error or a force interrupt. SQLSTATE=55032 | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All * **************************************************************** * PROBLEM DESCRIPTION: * * SQL1224N may result when the condition in a trigger WHEN * * clause * * or an IF statement references both: * * 1. an SQL scalar or row function * * 2. a subquery * * * * Example: * * CREATE TABLE PARTITION ( ID INT NOT NULL, STATUS SMALLINT * * NOT * * NULL, LOAD_ID INT NOT NULL ) * * * * CREATE TABLE DOMAIN ( PROPERTY VARCHAR ( 32 ) NOT NULL, NAME * * * * VARCHAR ( 32 ) NOT NULL, CODE SMALLINT NOT NULL ) * * * * * * CREATE FUNCTION GET_PROPERTY(p VARCHAR(32), s VARCHAR(32)) * * * * RETURNS INT * * READS SQL DATA * * DETERMINISTIC * * RETURN SELECT domain.code FROM domain WHERE domain.property * * = p * * AND domain.name = s * * * * * * CREATE FUNCTION GET_STATUS(s VARCHAR(32)) * * RETURNS INT * * READS SQL DATA * * DETERMINISTIC * * RETURN GET_PROPERTY('STATUS', s) * * * * CREATE TRIGGER RECORD_HISTORY * * AFTER UPDATE OF STATUS ON PARTITION * * REFERENCING NEW AS N * * FOR EACH ROW MODE DB2SQL * * WHEN (((N.status = get_status('STORED'))) AND ((SELECT * * COUNT(*) * * FROM partition)=0) ) * * BEGIN * * END * * * * update partition set status = get_status('STORED') where id * * = * * 562126 * * DB21034E The command was processed as an SQL statement * * because * * it was not a * * valid Command Line Processor command. During SQL processing * * it * * returned: * * SQL1224N The database manager is not able to accept new * * * * requests, has * * terminated all requests in progress, or has terminated your * * * * particular request * * due to an error or a force interrupt. SQLSTATE=55032 * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 Version 9.7 Fix Pack 1 or later. * **************************************************************** | |
Local Fix: | |
Do not specify both an SQL function and a subquery in the condition in the trigger WHEN clause or the IF statement. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows | |
Solution | |
The problem has been fixed in DB2 Version 9.7 Fix Pack 1 | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 22.10.2009 16.02.2010 16.02.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP1 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.1 |