MySQL Forums
Forum List  »  Triggers

user dependent trigger ?
Posted by: uwe resch
Date: April 24, 2011 03:19AM

is it possible to create a trigger wich works different for different user ?

something like this:

DELIMITER $$

CREATE
TRIGGER `test`.`testvalue1_BI` BEFORE INSERT
ON `test`.`testvalue1`
FOR EACH ROW BEGIN
IF user='userA' THEN
INSERT INTO testfed.testvalueA(DATA) VALUES(new.data);
SET new.id= (SELECT id FROM testfed.testvalue1 WHERE DATA=new.data);
END IF
IF user='userb' THEN
INSERT INTO testfed.testvalueB(DATA) VALUES(new.data);
SET new.id= (SELECT id FROM testfed.testvalueB WHERE DATA=new.data);
END IF
END$$

DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
user dependent trigger ?
1822
April 24, 2011 03:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.