I have a problem with my trigger. It returns “no data found” and i don’t know how to resolve it. Can you help me ?
create or replace
TRIGGER nb_action
AFTER INSERT ON Message
FOR EACH ROW
DECLARE
vAuteur integer;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
SELECT id_auteur INTO vAuteur FROM Message where id_message = :new.id_message;
UPDATE Utilisateur SET nb_action=nb_action+1 where id_utilisateur=vAuteur;
END ;
Since you have
PRAGMA AUTONOMOUS_TRANSACTION;in that trigger it means that it can’t see the row just inserted because it is in a different not yet committed transaction thus yourSELECTdoesn’t return any data…try