Create Trigger in VStudio
Bart Pietercil
bart.pietercil at gmail.com
Tue Jun 19 05:24:00 CDT 2007
Hi List, Ruslan
I created 2 triggers with this statement:
CREATE OR REPLACE TRIGGER "trigger_tbl_users_BI" BEFORE INSERT
ON "tbl_users" FOR EACH ROW
BEGIN
NEW.creation_dt = NOW();
NEW.modification_dt = NOW();
NEW.objptr_modified_by = @user_id;
NEW.objptr_created_by = @user_id;
END;
CREATE OR REPLACE TRIGGER "trigger_tbl_users_BU" BEFORE UPDATE
ON "tbl_users" FOR EACH ROW
BEGIN
NEW.modification_dt = NOW();
NEW.objptr_modified_by = @user_id;
END;
I created this through the SQL-editor with ONE execute
In VStudio 2 triggers are created
First problem: They only show up after reopening the DB (close DB-->
open DB)
Is this for Mantis ?
Second Problem: When in VStudio I select the trigger, the trigger
text has the complete execute text
I select trigger "trigger_tbl_users_BI" and the trigger text reads:
CREATE OR REPLACE TRIGGER "trigger_tbl_users_BI" BEFORE INSERT
ON "tbl_users" FOR EACH ROW
BEGIN
NEW.creation_dt = NOW();
NEW.modification_dt = NOW();
NEW.objptr_modified_by = @user_id;
NEW.objptr_created_by = @user_id;
END;
CREATE OR REPLACE TRIGGER "trigger_tbl_users_BU" BEFORE UPDATE
ON "tbl_users" FOR EACH ROW
BEGIN
NEW.modification_dt = NOW();
NEW.objptr_modified_by = @user_id;
END;
The same goes for the second trigger
Bug? Mantis?
3 Problem: I used the statement SET @user_id = 1 which is accepted
Then I realised this was wrong (my mistake) so I wanted to do this
SET @user_id = NULL
This gives unexpected token. Why ?
TIA
Bart
More information about the Valentina
mailing list