Kbase 19353: SQL-92 Guide and Reference has wrong syntax for NEWROW.getvalue() and OLDROW.getvalue().
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
FACT(s) (Environment):
Progress 9.x
SYMPTOM(s):
Some examples in the Progress "SQL-92 Guide and Reference" manual regarding NEWROW.getvalue() and OLDROW.getvalue() are written with wrong syntax.
Code from the "SQL-92 Guide and Reference" manual fails to run correctly.
CAUSE:
The section regarding NEWROW.getvalue() and OLDROW.getvalue() are written with wrong syntax. Pages 4 - 38 show the following example:
OLDROW.getvalue(10, old_status);
NEWROW.getvalue(10, new_status);
FIX:
These lines should be changed to the following:
old_status = (String) OLDROW.GetValue(10, CHAR);
new_status = (String) NEWROW.getValue(10, CHAR);
The following is a working example against the Sports2000 Database:
CREATE TRIGGER LOGTRIG
BEFORE UPDATE
ON PUB.Customer
REFERENCING OLDROW, NEWROW
FOR EACH ROW
BEGIN
short junkvar = 0;
cnum = (Integer) NEWROW.getValue( 1, junkvar);
cname = (String) NEWROW.getValue( 2, junkvar);
SQLIStatement InsertLog =
new SQLIStatement ("INSERT INTO pub.CustLog VALUES (?,?,?)");
InsertLog.setParam(1, cnum);
InsertLog.setParam(2, cname);
InsertLog.setParam(3, "This is generated by JAVA trigger");
InsertLog.execute();
END.