Kbase 20202: CREATE TRIGGER on Field Gives Error (7587)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  9/2/2004 |
|
Status: Unverified
SYMPTOM(s):
When you create an UPDATE trigger for SQL-92, you might get the following error:
Syntax Error (7587).
CAUSE:
The SQL-92 Guide and Reference for Progress Version 9.1x contains a documentation bug in the syntax of the CREATE TRIGGER statement:
CREATE TRIGGER cust_name_update
AFTER UPDATE OF name ON pub.customer
REFERENCING NEWROW
FOR EACH ROW
IMPORT
<import statements>
BEGIN
<trigger code>
END;
This trigger is intended to fire when the customer.name column is updated. The incorrect syntax relates to the OF clause. The reason there is no .java file created is because the SQL parser could not understand the syntax of the statement enough to be able to create the .java source code.
FIX:
The list of columns in the OF clause must be in parenthesis. The correct syntax is:
CREATE TRIGGER cust_name_update
AFTER UPDATE OF (name) ON pub.customer
REFERENCING NEWROW
FOR EACH ROW
IMPORT
<import statements>
BEGIN
<trigger code>
END;