user2500861
user2500861

Reputation:

Creating trigger for multiple table insert operation

I have created table in Slq yog which was working fine. then i created same on mysql terminal. this also executes with no error:

DELIMITER $$ 
CREATE TRIGGER trigger1 AFTER INSERT ON table2  FOR EACH ROW BEGIN 
INSERT INTO record VALUES (id,NEW.sent); 
INSERT INTO temp values (id,NEW.sent,NEW.pcount,NEW.ncount); 

END

$$ DELIMITER ;

But after this when I enter show triggers or any other command it ask for -> no input

so I need to terminate mysql. Then when I check show triggers says Empty set.

Where is the mistake here?

Upvotes: 1

Views: 1048

Answers (1)

mostafa khansa
mostafa khansa

Reputation: 302

DELIMITER $$ 
CREATE TRIGGER trigger1 AFTER INSERT ON table2  FOR EACH ROW BEGIN 
INSERT INTO record VALUES (id,NEW.sent); 
INSERT INTO temp values (id,NEW.sent,NEW.pcount,NEW.ncount); 

END

$$ 

DELIMITER ;

new delimiter must be on another line

Upvotes: 1

Related Questions