create or replace procedure info_disp(dt date,sft B_D.shift%type)
is
cursor c1 is select B_D.bus_no,d_name from Bus,Driver1,B_D
where Bus.bus_no=B_D.bus_no and Driver1.driver_no=B_D.driver_no
and date_of_alloted=dt and shift=sft;
rec c1%rowtype;
begin
dbms_output.put_line(dt||' '||sft);
open c1;
loop
fetch c1 into rec;
exit when c1%notfound;
dbms_output.put_line(rec.bus_no||' '||rec.d_name);
end loop;
close c1;
end;
declare
date_of_duty date:='&date_of_duty';
duty_shift B_D.shift%type:='&duty_shift';
begin
info_disp(date_of_duty,duty_shift);
end;
Q2)
create or replace trigger t13
before insert or update on Driver1
for each row
begin
if(:new.age<18)then
raise_application_error(-2013,'the age is less than 18 ');
elsif(:new.age>50)then
raise_application_error(-2013,'the age is greater than 50.');
end if;
end;