My apologies, try this:
DELIMITER ;;
CREATE TRIGGER DEL_TB_INSTRUKSI AFTER DELETE ON Tb_Instruksi
FOR EACH ROW
BEGIN
DELETE FROM Tb_Stuffing WHERE No_Instruksi = OLD.No_Instruksi;
END;
;;
DELIMITER ;
To answer your question:
The DELIMITER statement tells MySQL to use a different set of
characters to terminate statements. This is necessary when you want
to use a ";" in your actual statement. In this case, the entire
trigger definition is considered one statement, but the ";" in the
"DELETE..." line is being interpreted as the termination of it.
Yes, it's dumb.
On Nov 7, 2007, at 2:53 AM, Lucky Wijaya wrote:
No, I didn't set the delimiter. But, it still have an error after I
set delimiter in my trigger as your example. By the way, what's
delimiter mean ? And what it's for ?
Thanks to you Mr. David.
David Schneider-Joseph <[EMAIL PROTECTED]> wrote: Lucky,
Did you make sure to set your delimiter before and after the CREATE
TRIGGER statement? e.g.:
DELIMITER ;;
CREATE TRIGGER DEL_TB_INSTRUKSI AFTER DELETE ON Tb_Instruksi
FOR EACH ROW
BEGIN
DELETE FROM Tb_Stuffing WHERE No_Instruksi = OLD.No_Instruksi;
END;;
DELIMITER ;
On Nov 6, 2007, at 11:11 PM, Lucky Wijaya wrote:
Hi, my name is Lucky from Indonesia. I build an database application
using Delphi 7 & MySQL as the RDBMS. Now, I'm having problem in
creating trigger in MySQL. Here is the code of the trigger:
CREATE TRIGGER DEL_TB_INSTRUKSI AFTER DELETE ON Tb_Instruksi
FOR EACH ROW
BEGIN
DELETE FROM Tb_Stuffing WHERE No_Instruksi = OLD.No_Instruksi;
END;
It results an error message that the SQL syntax (on delete command)
is incorrect. I didn't find yet the incorrect part of my SQL syntax.
Could somebody help my problem ? Thank you very much.
Note: I'm already using MySQL v. 5.0.41 and using GUI in creating
the trigger. I also have tried to create the trigger through mysql
command line, but it result the same error message.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]