I want to write a trigger in PL/SQL. My first aim is to compare two time_stamp data type (A and B). If one of these is bigger than another, for instance A>B, i will update columns on another table. Trigger that i try to write is like below.
CREATE OR REPLACE TRIGGER trigger_name
AFTER INSERT OR UPDATE OR DELETE ON views
FOR EACH ROW
DECLARE
A views.X%TYPE;
B views.Y%TYPE;
C views.Z%TYPE;
BEGIN
SELECT X, Y, Z INTO A, B, C FROM views;
IF A>B THEN
update another_table set D=' ' and E='UNRESOLVED' where column1=A;
ELSE
dbms_output.put_line('ABC: ' || A || ' < ' || 'CDE' || B);
END IF;
END;
If i execute this trigger, i'm getting error like below.
Error report: ORA-25001: kan inte skapa den här triggertypen i den här typen av vy 25001. 00000 - "cannot create this trigger type on views" *Cause: Only INSTEAD OF triggers can be created on a view. *Action: Change the trigger type to INSTEAD OF.
Thanks in advance for your help.