Q1)create or replace procedure p7
as
cursor ips is select u_name,c_no, c_name, c_city, year from University u ,College c
where u.u_no=c.u_no
order by year;
begin
for x in ips
loop
dbms_output.put_line(x.u_name||' '||x.c_no||' '||x.c_name||' '||x.c_city||' '||x.year);
end loop;
end;
output:declare
begin
p7;
end;
Q2)
create or replace trigger t12
before insert or update on College
for each row
begin
if(:new.year<:new.year) then
raise_application_error(-2013,'current year should be greater than previous year');
end if;
end;