MySQL Forums
Forum List  »  Triggers

Trigger Problem
Posted by: Jose Nicodemos Maia Neto
Date: October 08, 2012 01:27PM

I tryed to create this trigger with PHPMyAdmin and MySQL Server (5.1.54-rel12.6-log).
And PHPMyAdmin tell me a success.
But when i list all the Trigger, there is nothing!
x.X

DELIMITER $$

DROP TRIGGER IF EXISTS auChecarPosicao;
CREATE TRIGGER auChecarPosicao
AFTER UPDATE ON com_orcamento_det
FOR EACH ROW
BEGIN
SET @_result = 0;

IF(OLD.orcd_situacao <> NEW.orcd_situacao AND NEW.orcd_situacao <> 6 AND NEW.orcd_situacao <> 5)
THEN
SELECT orcc_id_posicao INTO @pos
FROM com_orcamento_cab
WHERE orcc_id_orcamento = NEW.orcd_id_orc_cab
AND orcc_id_revisao = NEW.orcd_id_orc_cab_revisao;

IF(@pos = 1)
THEN
IF(NEW.orcd_situacao <> 1 OR NEW.orcd_situacao <> 11)
THEN
SET @_result = 3;
END IF;
ELSE IF (@pos = 17)
THEN
SET @_result = 3;

IF(NEW.orcd_situacao = 17)
THEN
SELECT count(orcd_situacao) INTO @res
FROM com_orcamento_det
WHERE orcd_id_orc_cab = NEW.orcd_id_orc_cab
AND orcd_id_orc_cab_revisao = NEW.orcd_id_orc_cab_revisao
AND orcd_situacao <> 17;

IF(@res = 0)
THEN
SET @_result = 17;
END IF;
END IF;
END IF;
END IF;

IF(@_result <> 0)
THEN
UPDATE com_orcamento_cab
SET orcc_id_posicao = @_result
WHERE orcc_id_orcamento = NEW.orcd_id_orc_cab
AND orcc_id_revisao = NEW.orcd_id_orc_cab_revisao;
END IF;
END $$ DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger Problem
1818
October 08, 2012 01:27PM
1030
October 23, 2012 11:52AM


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.