IBM Support

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

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%                                        

[{"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"RDS","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"7.0;8.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21078667