trigger insert

Solutions on MaxInterview for trigger insert by the best coders in the world

showing results for - "trigger insert"
Beatrice
27 Oct 2017
1-- SQL Server (update my_table2 after insert on my_table1)
2CREATE TRIGGER trigger_name ON my_table1 FOR INSERT AS
3BEGIN
4    UPDATE my_table2 SET my_col_date = getdate() FROM my_table1 
5END
6-- Oracle (insert into log table after update on my_table)
7CREATE OR REPLACE TRIGGER trigger_name AFTER INSERT ON my_table
8FOR EACH ROW
9BEGIN
10    INSERT INTO my_log_table (LOG_DATE, ACTION) VALUES (SYSDATE, 'Changed');
11END;