IBM Support

SQLCODE -104 on a CREATE TRIGGER statement using syntax supported by DB2 UDB EE

Technote (FAQ)


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%                                        

Document information

More support for: DB2 for z/OS
RDS

Software version: 7.0, 8.0

Operating system(s): z/OS

Reference #: 1078667

Modified date: 17 December 2016


Translate this page: