2
Answers

Many Queries are allowed or Not allowed in Trigger?

A Kumar

A Kumar

10y
606
1
Many Queries are allowed or Not allowed in Trigger?
 
Answers (2)
0
Munesh Sharma
NA 17.1k 2.4m 10y

Multiple insert/update statements inside trigger?

trigger_stmt is the statement to execute when the trigger activates. If you want to execute multiple statements, use the BEGIN ... END compound statement construct. This also enables you to use the same statements that are allowable within stored routines

CREATE TRIGGER testref BEFORE INSERT ON test1
FOR EACH ROW BEGIN

INSERT INTO test2 SET a2 = NEW.a1;

DELETE FROM test3 WHERE a3 = NEW.a1;

UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1;

END;
0
Vithal Wadje
NA 47.6k 23.3m 10y
I don't get Many Queries means what but you can write multiple quiries inside the trigger