how to trigger a nested table(Oracle)

wxdqz

New Member
(in Oracle)

I have (1)parent table: students
(2) child table: enrollment.

I can create the following trigger, but according to the results it only triggers on
the parent table students.

So, how can I trigger the child table?

create trigger enrollMax after insert on students --a nested table won't allowed.
referencing new as x
for each row
--Subsequeries/UDFs are not allowed in when declare
num int;
begin
select count(*) into num from table(select s.enrollment from students s
where s.sid = :x.sid);
if num > 2 then
raise_application_error(-20003, 'Invalid Enrollment Attempted on Insert');
end if;
end;
 
Back
Top