Read-only 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
BEGIN
IF INSERTING THEN
NULL;
ELSIF UPDATING THEN
NULL;
ELSE
NULL;
END IF;
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
END