Updatable trigger
(Example in Oracle)
CREATE OR REPLACE TRIGGER AGENCY_PF.EXAMPLE_TRIGGER
INSTEAD OF INSERT OR UPDATE OR DELETE ON AGENCY_PF.YOUR_TABLE
FOR EACH ROW
DECLARE
BEGIN
IF INSERTING THEN
NULL;
ELSIF DELETING THEN
NULL;
ELSIF UPDATING THEN
-- Update your actual table here
END ;
END
(Example in SQL Server)
CREATE TRIGGER AGENCY_PF.EXAMPLE_TRIGGER ON AGENCY_PF.YOUR_TABLE
INSTEAD OF INSERT, UPDATE, DELETE
AS
BEGIN
IF EXISTS(SELECT * FROM DELETED)
BEGIN
IF EXISTS(SELECT * FROM INSERTED)
BEGIN
--Update being performed, insert appropriate code here.
END
ELSE
BEGIN
--Delete being performed, insert appropriate code here.
END
END
ELSE
BEGIN
IF EXISTS(SELECT * FROM INSERTED)
BEGIN
--Insert being performed, insert appropriate code here.
END
END