Hi Ocke,
What you think I actually read that SQL statement before executing
it....come on it was late. Yes, the tigger in the sample does work
correctly. Great 2 tick marks..
Ok - the bad trigger.
First - my statement is wrong...but here it is.
Create a new base file.
Open the SQL window
Apply these two statements - separately and without closing the SQL
window in between:
CREATE TABLE category (
category_id IDENTITY PRIMARY KEY,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
)
*execute succeeds*
CREATE TRIGGER category_last_upate
BEFORE UPDATE ON category
REFERENCING NEW ROW AS newrow OLD ROW AS oldrow
FOR EACH ROW SET newrow.last_update = CURRENT_TIMESTAMP
*execute succeeds*
Ok now you can close the SQL window, add data to the table, etc. The
trigger doesn't work, but doesn't complain either.
Close the file.
Try to reopen - error in the Create trigger statement - my guess is
because I declared an OLDROW variable and never used it.
-or-
maybe it is the use of the set keyword..but, if I use this (also
wrong) trigger statement
CREATE TRIGGER category_last_upate
BEFORE UPDATE ON category
REFERENCING NEW ROW AS newrow
FOR EACH ROW SET newrow.last_update = CURRENT_TIMESTAMP
It is accepted, doesn't work, but doesn't stop the HSQLdb engine from
restarting next time it's opened.
Attaching a file created under Win 7, just now with the above steps.
Drew,
ps Ctrl-C instead of screen shots...lol...like I said it was late..
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]