Question & Answer
Question
Receiving SQLCODE -104 on a CREATE TRIGGER statement using syntax that is supported by DB2® UDB EE.
Answer
If you are using syntax that is supported by DB2 on other platforms, you might encounter this error. SQL code -104 can result if there was an SQL statement in the trigger body that had a subselect specified for an expression. In DB2® for z/OS and OS/390® R510, R610, and R710, an expression cannot be a subselect.
R810 allows a subselect as an expression. Here is an example of this type of CREATE TRIGGER statement that would cause this error prior to R810:
CREATE TRIGGER TRGTEST
NO CASCADE
BEFORE INSERT ON TABB
REFERENCING NEW AS NEWROW FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET NEWROW.COLB
= (SELECT MAX(COLA) FROM TABA);
END%
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21078667