3

I am working on phpmyadmin. To write triggers i am using mysql console.
Its works well in starting. but as soon as i am writing a trigger and its gets execute successfully then every time after any query i have to give delimiter (|) to execute the query.
I am not able to understand why i have to put delimiter after a simple select query? Delimiter is for trigger rite.
Am i missing something in writing trigger? for exmp:

after a trigger i am writing select statement than i have to write it as:

select * from tableName;|

If i am not using | its not getting execute.

Harjeet Jadeja
  • 1,594
  • 4
  • 19
  • 39

2 Answers2

2

Try this :

DELIMITER $$

DROP TRIGGER IF EXISTS `myTriggerName`$$

CREATE TRIGGER `myTriggerName` AFTER DELETE ON `myTableName` FOR EACH ROW BEGIN

...........
............
.............

END$$
DELIMITER ;
Baby Groot
  • 4,637
  • 39
  • 52
  • 71
0

After the trigger is created, you need to change the delimiter back to ';'

See examples in the manual:

http://dev.mysql.com/doc/refman/5.6/en/stored-programs-defining.html

delimiter //

... your trigger here ...

delimiter ; <-- change the delimiter back
Marc Alff
  • 8,227
  • 33
  • 59