I have a table passenger as shown below
Column Null? Type
------------------------------------
NAME - VARCHAR2(20)
ID NOT NULL NUMBER
ADDRESS - VARCHAR2(20)
CHARGES - NUMBER
I am learning triggers and I want to create a trigger that updates charges as charges 100 before a new insert is done. Here is the trigger I created.
create or replace trigger flight
before insert on passenger
for each row
set new.charges = new.charges 100;
/
However, I am getting the error ORA-04079: invalid trigger specification
. I have tried replacing new
with :new
, adding begin & end blocks, but none of them seem to work.
CodePudding user response:
Invalid syntax.
create or replace trigger flight
before insert on passenger
for each row
begin
:new.charges := :new.charges 100;
end;
/