Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Trigger problem

Trigger problem

2007-11-13       - By scott

 Back
Reply:     1     2     3     4     5     6  


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@(protected)> 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=luckyx_cool_boy@(protected)
.com
> >
> >
> >
> > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> > 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=luckyx_cool_boy@(protected)
.com
>
>
>
>  __ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

mysql> show triggers;


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@(protected)