create or replace procedure xyz(comptype in varchar2, yr in number)
as
cursor c1 is select comp_name,comp_no from Competition c where c.comp_type=comptype;
cursor c2 is select c.comp_no from Competition c, stud_comp sc
where c.comp_no=sc.comp_no
and year=yr;
c c1%rowtype;
d c2%rowtype;
begin
open c1;
loop
fetch c1 into c;
exit when c1%notfound;
end loop;
open c2;
loop
fetch c2 into d;
exit when c2%notfound;
dbms_output.put_line('comp type'||c.comp_no);
dbms_output.put_line('comp name'||c.comp_name);
end loop;
end;
Q2)
create or replace trigger t12
before insert or update on stud_comp
for each row
begin
if(:new.rank>3) then
raise_application_error(-2013,'the Rank value should be less 3');
end if;
end;