create table Route(route_no number primary key, source varchar2(20), destination varchar2(20), no_of_station number);
create table Bus(bus_no number primary key, capacity number check(capacity>40), depot_name varchar2(20),route_no references Route(route_no));
insert into Route values(1,'chikhali','akurdi',3);
insert into Route values(2,'chikhali','nigdi',4);
insert into Route values(3,'akurdi','pune',10);
insert into Bus values(101,43,'nigdi',1);
insert into Bus values(102,43,'chikhali',1);
insert into Bus values(103,43,'nigdi',2);
insert into Bus values(104,43,'pimpri',1);
Q1)
create or replace procedure p7(rt in number)
as
cursor c1 is select bus_no, capacity, depot_name from Route r ,Bus b
where r.route_no=b.route_no and r.route_no=rt;
begin
for x in c1 loop
dbms_output.put_line(x.bus_no||' '||x.capacity||' '||x.depot_name);
end loop;
end;
declare
begin
p7(1);
end;
Q2)
create or replace trigger t11
before insert or update on Route
for each row
begin
if(:new.no_of_station<0) then
raise_application_error(-2013,'the no of station should be greater than zero');
end if;
end;
Recent Posts
Posted on 2019-07-18
Posted on 2019-07-18
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-05-28
Posted on 2019-05-24
Posted on 2019-05-24
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23