I'm looking forward to create a trigger on sql oracle and my goal is to check if there is no other room being occupied at the same time by another "class" in the same table.
So, I thought I could create something like this:
create trigger checkRoomBusy
before insert on tiime
for each row
begin
IF (not exists(select count(*) from tiime where room=:new.room AND daay=:new.daay AND hoour=:new.hoour AND miin=:new.miin))
THEN
insert into tiime (daay, hoour, miin, class_id)
values(:new.daay, :new.hoour, :new.miin, :new.class_id);
END IF;
END;
/
but my sgbd gave me the error:
ORA-24344: success with compilation error
what can I improve to avoid the error and make the trigger workable?
PS: I can just use the 11g sql oracle.
Thank you in advance.