Hi,
Originally I was trying to create a trigger using a case statement inside it, testing multiple scenarios and signal different errors. It was not working... I was testing, testing until I finally get to the IBM documentation . I copied a example which does not work in my IBM® Data Studio Version 3.2.0.0, which is accessing a DB2 9.1 running on a Linux machine trough JDBC. The query and the error are the following:
CREATE TRIGGER REORDER
AFTER UPDATE OF ON_HAND, MAX_STOCKED ON PARTS
REFERENCING NEW TABLE AS NTABLE
FOR EACH STATEMENT
BEGIN ATOMIC
SELECT ISSUE_SHIP_REQUEST(MAX_STOCKED - ON_HAND, PARTNO)
FROM NTABLE
WHERE (ON_HAND < 0.10 * MAX_STOCKED);
END;
An unexpected token "END-OF-STATEMENT" was found following "0.10 * MAX_STOCKED)". Expected tokens may include: "<delim_semicolon>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.14.113
The error is in the comma after the parentheses in the where clause.
What can this be? Version issue?
Originally I was trying to create a trigger using a case statement inside it, testing multiple scenarios and signal different errors. It was not working... I was testing, testing until I finally get to the IBM documentation . I copied a example which does not work in my IBM® Data Studio Version 3.2.0.0, which is accessing a DB2 9.1 running on a Linux machine trough JDBC. The query and the error are the following:
CREATE TRIGGER REORDER
AFTER UPDATE OF ON_HAND, MAX_STOCKED ON PARTS
REFERENCING NEW TABLE AS NTABLE
FOR EACH STATEMENT
BEGIN ATOMIC
SELECT ISSUE_SHIP_REQUEST(MAX_STOCKED - ON_HAND, PARTNO)
FROM NTABLE
WHERE (ON_HAND < 0.10 * MAX_STOCKED);
END;
An unexpected token "END-OF-STATEMENT" was found following "0.10 * MAX_STOCKED)". Expected tokens may include: "<delim_semicolon>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.14.113
The error is in the comma after the parentheses in the where clause.
What can this be? Version issue?