List:General Discussion« Previous MessageNext Message »
From:Scott Date:November 13 2007 12:46pm
Subject:Re: Trigger problem
View as plain text  
On Thu, 2007-11-08 at 17:56 -0800, Lucky Wijaya wrote:
> Yes, the trigger code is works. Many thanks !!
> Now I understand the use of delimiter command. Thanks again... =)
> 
> My next question is, do we able to view the triggers that has been created ? And how
> ?
> 
> David Schneider-Joseph <david@stripped> wrote: 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  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/mysql?unsub=1
> >
> >
> >
> > __________________________________________________
> > 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/mysql?unsub=1
> 
> 
> 
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

mysql> show triggers;

Thread
Trigger problemLucky Wijaya7 Nov
  • Re: Trigger problemDavid Schneider-Joseph7 Nov
    • Re: Trigger problemLucky Wijaya7 Nov
      • Re: Trigger problemDavid Schneider-Joseph7 Nov
        • Character encoding problemJames Sherwood7 Nov
          • Re: Character encoding problemmysql7 Nov
            • Re: Character encoding problemJames Sherwood7 Nov
              • Re: Character encoding problemJames Sherwood8 Nov
                • Re: Character encoding problemJames Sherwood8 Nov
              • Re: Character encoding problemmysql8 Nov
                • Character encoding problem STILLJames Sherwood9 Nov
                  • Re: Character encoding problem STILLAnanda Kumar9 Nov
        • Re: Trigger problemLucky Wijaya9 Nov
          • Re: Trigger problemScott13 Nov