![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| defining variables | em23 | Shell Programming and Scripting | 12 | 01-04-2009 02:49 PM |
| defining a printer in qconfig | matheeq | AIX | 0 | 03-18-2008 11:55 AM |
| Defining X and Y Coordinates Inside A Window | lesnaubr | Shell Programming and Scripting | 1 | 08-16-2007 08:19 AM |
| Defining Variables | sailorliones | UNIX for Dummies Questions & Answers | 4 | 07-21-2006 03:09 PM |
| Defining variables at boot time | ianf | UNIX for Dummies Questions & Answers | 7 | 01-07-2002 01:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Problems with defining triggers
I am running the example from the following webpage:
MySQL :: MySQL 5.0 Reference Manual :: 12.1.11 CREATE TRIGGER Syntax and the problem is that triggers cannot be defined for some reason: Code:
CREATE DATABASE IF NOT EXISTS triggertest;
USE triggertest;
CREATE TABLE test1(a1 INT);
CREATE TABLE test2(a2 INT);
CREATE TABLE test3(a3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE test4(
a4 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
b4 INT DEFAULT 0
);
delimiter |
CREATE TRIGGER testref BEFORE INSERT ON test1
FOR EACH ROW BEGIN
INSERT INTO test2 SET a2 = NEW.a1;
DELETE FROM test3 WHERE a3 = NEW.a1;
UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1;
END;
|
delimiter ;
Code:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter | CREATE TRIGGER testref BEFORE INSERT ON test1 FOR EACH ROW BE' at line 1 Code:
# mysql -v Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 164 Server version: 5.1.28-rc FreeBSD port: mysql-server-5.1.28_1 |
|
||||
|
I would also encourage you to use the manual for your version of mysql.
MySQL :: MySQL 5.1 Reference Manual :: 12.1.19 CREATE TRIGGER Syntax |
|
||||
|
Yes, thanks for pointing that out.
|
| Sponsored Links | ||
|
|