MySQL Forums
Forum List  »  French

Re: Récupération d'un numéro auto incrémenté dans un trigger
Posted by: Jean-Marie DUCHESNE
Date: December 11, 2013 04:16AM

J'ai créé la procédure stockée suivant :

CREATE PROCEDURE Lier_origine(IN num_action INT)
BEGIN
UPDATE action SET act_action_origine=num_action WHERE act_id = num_action;
END

et la trigger AFTER INSERT suivant :

REATE TRIGGER `action_AINS` AFTER INSERT ON action FOR EACH ROW
-- Edit trigger body code below this line. Do not edit lines above this one
BEGIN
SET @numero_action = LAST_INSERT_ID();
IF(NEW.act_action_origine IS NULL) THEN
CALL Lier_origine(@numero_action);
END IF;
END

mais lors de l'insertion j'ai l'erreur suivante :

Can't update table 'action' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

Avez-vous une idée pour corriger ce problème?

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Récupération d'un numéro auto incrémenté dans un trigger
1809
December 11, 2013 04:16AM


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.