I have a table area and doctor. The doctor has a varray of specialities and a reference of the area that works in. The trigger that i am trying to create checks if the name of the area that i will be referencing in the update is the same as the name of one of his specialities.
I have been trying different things but none of the work
Example 1.
CREATE OR REPLACE TRIGGER TRIGGER9
BEFORE INSERT ON DOCTOR
FOR EACH ROW
WHEN (deref(new.worksIn).name in (select m.COLUMN_VALUE.name from table (select deref(specialities) from doctor where pid = new.pid)
BEGIN
null;
END;
Example 2.
CREATE OR REPLACE TRIGGER TRIGGER9
BEFORE INSERT ON DOCTOR
FOR EACH ROW
BEGIN
if deref(:new.worksIn).name in (select deref(:new.specialities).name) then
-- stuff happens
end if
END;
Thanks in advance!