The DROP TRIGGER command is in the wrong place. You changed the delimiter to $$ 
but still tried to use the semicolon(;) with DROP TRIGGER.

Your code should read like this:
    DROP TRIGGER IF EXISTS cfe_tg_calcular_consumos;
    DELIMITER $$
    CREATE TRIGGER cfe_tg_calcular_consumos
    AFTER INSERT ON cfe_lecturas_tiendas

Or change the ; to $$ on the DROP TRIGGER command like this:
    DELIMITER $$
    DROP TRIGGER IF EXISTS cfe_tg_calcular_consumos $$
    CREATE TRIGGER cfe_tg_calcular_consumos
    AFTER INSERT ON cfe_lecturas_tiendas

Give it a try !!!

Rolando A. Edwards
MySQL DBA (CMDBA)

155 Avenue of the Americas, Fifth Floor
New York, NY 10013
212-625-5307 (Work)
201-660-3221 (Cell)
AIM : RolandoLogicWorx
Skype : RolandoLogicWorx
redwa...@logicworks.net


-----Original Message-----
From: Mauricio Tellez [mailto:mauricio.tel...@gmail.com] 
Sent: Wednesday, May 13, 2009 4:35 AM
To: mysql@lists.mysql.com
Subject: Trigger working with server 5.0.51 but not 5.0.22

Hi, I'm developed a trigger with mysql version 5.0.51(ubuntu), and when I
tried to move this to a production server (version 5.0.22 fedora) I ran into
2 problems:

1. I try to install the trigger from a text file, and the first lines were:
    DELIMITER $$
    DROP TRIGGER IF EXISTS cfe_tg_calcular_consumos;
    CREATE TRIGGER cfe_tg_calcular_consumos
    AFTER INSERT ON cfe_lecturas_tiendas
but mysql say there is an error near EXISTS cfe_tg_calculas_consumos. Of
course I use this text file at my development environment without problem.
And at production server I need to delete the line DROP TRIGGER ... to
create the trigger.

2. This trigger create a temporary table and then call a stored procedure
wich does some arithmetic and put the result in the temporary table. When
the trigger get fired at the production server, I got  *"**SQL Error:* 1146:
Table 'filasPOS.tmp_calculos_res' doesn't exist"

Is there a big change in handling triggers from version 5.0.22 to 5.0.51? Or
I missing something? Thanks in advance

-- 
Mauricio Tellez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to