Topic
  • No replies
Mostapha Abd El-Salam
3 Posts

Pinned topic Error : Create Triggers

‏2013-05-05T13:37:13Z |

show error during create the triggers !!! why ???

 

Create the table :

DROP TABLE TAB;
CREATE TABLE TAB
(
  ID INTEGER NOT NULL,
  PAYLOAD INTEGER,
  CONSTRAINT PK PRIMARY KEY(ID)
);

 

Create the trigger :

CREATE TRIGGER DB2.TRG_BI_TAB NO CASCADE BEFORE INSERT ON DB2.TAB REFERENCING NEW AS NEW FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
   SET NEW.ID = (SELECT NVL(MAX(ID),0) FROM TAB) + 1;
END;

 

Errors to create trigger :

A syntax error in the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure was detected at the specified token
following the text "<text>". The "<text>" field indicates the 20
characters of the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure that preceded the token that is not valid.

Updated on 2013-05-05T13:37:40Z at 2013-05-05T13:37:40Z by Mostapha Abd El-Salam