Create a trigger that updates a column on one table when a column in another table is updated

Posted by GigaPr on Stack Overflow See other posts from Stack Overflow or by GigaPr
Published on 2010-04-20T19:41:22Z Indexed on 2010/04/21 4:03 UTC
Read the original article Hit count: 151

Filed under:
|
|

Hi,

i have two tables

Order(id, date, note)

and

Delivery(Id, Note, Date)

I want to create a trigger that updates the date in Delivery when the date is updated in Order.

I was thinking to do something like

CREATE OR REPLACE TRIGGER your_trigger_name
BEFORE UPDATE
ON Order
DECLARE
BEGIN
   UPDATE Delivery set date = ??? where id = ???
END;

How do I get the date and row id?

thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle