MySQL Forums
Forum List  »  Triggers

Syntax problem
Posted by: Sébastien
Date: March 15, 2006 03:13AM

I have a problem in my trigger but I don't no where :

I'm running on MySQL 5.0.18

Code :
delimiter //
CREATE TRIGGER trg_conso_entree AFTER UPDATE ON conso_entree
FOR EACH ROW
BEGIN
IF ((NEW.entree = '1') AND (OLD.entree = '0')) THEN
UPDATE consommable SET consommable.qtestock = consommable.qtestock + new.qte WHERE consommable.reference = new.refproduit
END IF;
END//
delimiter ;

----------------------------------

Error :
requête SQL:

delimiter // CREATE TRIGGER trg_conso_entree AFTER UPDATE ON conso_entree FOR EACH ROW BEGIN IF ((NEW.entree = '1') AND (OLD.entree = '0')) THEN UPDATE consommable SET consommable.qtestock = consommable.qtestock + new.qte WHERE consommable.reference = new.refproduit END IF;

MySQL a répondu:

#1064 - Syntax error near 'delimiter //
CREATE TRIGGER trg_conso_entree AFTER UPDATE ON co' at line 1

-------------------------------

If you want to test here is the code of the table :
CREATE TABLE `conso_entree` (
`num` int(11) NOT NULL auto_increment,
`datecom` date NOT NULL default '0000-00-00',
`dateentree` date default NULL,
`qte` int(11) NOT NULL default '0',
`entree` enum('1','0') NOT NULL default '0',
`refproduit` varchar(5) NOT NULL default '',
PRIMARY KEY (`num`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Syntax problem
2949
March 15, 2006 03:13AM
1874
March 15, 2006 08:01AM
2371
March 16, 2006 02:01AM
1937
March 15, 2006 08:22AM
2021
March 17, 2006 01:49AM
1802
March 20, 2006 09:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.