racemi racemi - 1 year ago 120
SQL Question

Error: ORA-04072: invalid trigger type

I did the following trigger:

create or replace trigger check_club_location
before of insert or update on club
for each row
declare cnt number;
select count(*) into cnt
from club
where club.location = :new.location;

if (cnt > 0) then
raise_application_error (-20100, 'Erro: ja existe club nessa localizacao.');
end if;

After I tried to run this trigger in Oracle APEX, the following error message appears:

ORA-04072: invalid trigger type.

I already tried many fixes but none worked on my trigger unfortunatelly.

Answer Source

You have a typo

before of insert or update on club

remove the "of", Oracle is complaining that "of" is not a valid trigger type