Medha Kulkarni
2007-05-19 13:49:40 UTC
Hi all,
I have defined a trigger on update of a non-xml column of a table. This table also has some XML column & trigger copies contents of this XML column to another table having XML column using XMLSERIALIZE function. After executing this trigger I get error:
"DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1242N An XML feature is not supported in the context where it is used.
Reason code = "6". LINE NUMBER=14. SQLSTATE=42997"
Is it that XMLSERIALIZE function cant be used in triggers?
The trigger looks something like this:
1. Trigger is defined on a following table:
DB2ADMIN.XML_TAB(
ID INTEGER,
REQUEST_TYPE INTEGER,
STATUS INTEGER,
REQ_DETAILS XML
)
2. Trigger populates following table:
DB2ADMIN.LOG_RESULT(
ID INTEGER,
ACTION_NAME VARCHAR(255),
ACTION_DETAILS XML
)
3. Create Trigger statement is as follow:
CREATE TRIGGER MY_TRG
AFTER UPDATE OF STATUS ON DB2ADMIN.XML_TAB
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
IF N.REQUEST_TYPE = 1 AND N.STATUS = 1 THEN
INSERT INTO DB2ADMIN.LOG_RESULT (ACTION_NAME,ACTION_DETAILS) VALUES
('APPROVE REQUEST', XMLSERIALIZE(N.XML_COL as VARCHAR(255)));
END IF;
END@
I also tried to insert XML value directly to target table WITHOUT using XMLSERIALIZE function & again got same error. i.e. :
"DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1242N An XML feature is not supported in the context where it is used.
Reason code = "6". LINE NUMBER=12. SQLSTATE=42997"
Any inputs on this will be really appreciated.
Thanks and Regards,
Medha.
I have defined a trigger on update of a non-xml column of a table. This table also has some XML column & trigger copies contents of this XML column to another table having XML column using XMLSERIALIZE function. After executing this trigger I get error:
"DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1242N An XML feature is not supported in the context where it is used.
Reason code = "6". LINE NUMBER=14. SQLSTATE=42997"
Is it that XMLSERIALIZE function cant be used in triggers?
The trigger looks something like this:
1. Trigger is defined on a following table:
DB2ADMIN.XML_TAB(
ID INTEGER,
REQUEST_TYPE INTEGER,
STATUS INTEGER,
REQ_DETAILS XML
)
2. Trigger populates following table:
DB2ADMIN.LOG_RESULT(
ID INTEGER,
ACTION_NAME VARCHAR(255),
ACTION_DETAILS XML
)
3. Create Trigger statement is as follow:
CREATE TRIGGER MY_TRG
AFTER UPDATE OF STATUS ON DB2ADMIN.XML_TAB
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
IF N.REQUEST_TYPE = 1 AND N.STATUS = 1 THEN
INSERT INTO DB2ADMIN.LOG_RESULT (ACTION_NAME,ACTION_DETAILS) VALUES
('APPROVE REQUEST', XMLSERIALIZE(N.XML_COL as VARCHAR(255)));
END IF;
END@
I also tried to insert XML value directly to target table WITHOUT using XMLSERIALIZE function & again got same error. i.e. :
"DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1242N An XML feature is not supported in the context where it is used.
Reason code = "6". LINE NUMBER=12. SQLSTATE=42997"
Any inputs on this will be really appreciated.
Thanks and Regards,
Medha.