0

delimiter // drop trigger if exists tr_overdue //

create trigger tr_overdue -- type of trigger, etc
after update on invoice for each row begin if status = 'overdue' then insert into alerts values(new.message_date,new.origin,new.message); SET action = 'update', message_date = NOW(), origin=old.campaignno, message = 'invoice with number ' + old.invoiceno + ' is now overdue'; end if; end

1 Answer 1

0
CREATE TRIGGER tr_overdue AFTER UPDATE ON Invoice FOR EACH ROW IF STATUS = 'overdue' THEN INSERT INTO alerts(columns1, column2,...) VALUES(new.message_date,new.origin,new.message);

I'm unsure if the columns you're updating in the SET statement also belong in Invoice, but if they do, then they should be included into the INSERT statement and that should fix the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.