Any updates?
Actually I am trying to achieve REPLACE/UPDATE ON DUPLICATE KEY CLAUSE (before insert) using triggers.
However I need to know Monetdb's trigger paradigm for the same.
And the docs don't say anything different from the widely known mysql/oracle triggers. Although the db is behaving differently.
Please help.
Thanks and Regards,
Tapomay.
________________________________
From: Tapomay Dey
To: Communication channel for Monet DB users
Sent: Tuesday, July 31, 2012 8:19 PM
Subject: Trigger: BEFORE INSERT
create table tt(id int, name varchar(20), value int);
create table t2(id int);
CREATE TRIGGER trg BEFORE INSERT ON tt
REFERENCING NEW as newrow
FOR EACH ROW
BEGIN ATOMIC
INSERT INTO t2 (id) values (newrow.id);
END
insert into tt values(1, 'a', 10);
insert into tt values(2, 'b', 20);
insert into tt values(3, 'a', 30);
insert into tt values(4, 'a', 40);
The result vales in t2 are:
After insert#1: EMPTY
After insert#2: {1}
After insert#3: {1, 1, 2}
After insert#4: {1, 1, 2,1,2,3}
Tested this in Mysql and the same trigger works well there.
Expected t2 values after insert#4: {1,2,3,4}
Regards,
Tapomay.