create table Owner(o_no number primary key, o_name varchar2(20), o_city varchar2(20), phno number(10));
create table Estate(e_no number primary key, e_type varchar2(20), e_city varchar2(20), e_price number(10),o_no number references Owner(o_no));
insert into Owner values(1,'yogesh','pune',9096188754);
insert into Owner values(2,'dipali','pune',9096188755);
insert into Owner values(3,'raj','pune',9096188756);
insert into Estate values(101,'flat','pune',4000000,1);
insert into Estate values(102,'land','pune',4500000,1);
insert into Estate values(103,'bunglow','mumbai',4100000,1);
insert into Estate values(104,'land','nashik',4900000,2);
Q1) create or replace procedure p7(wn in number)
as
cursor c1 is select e.e_no,e.e_type,e.e_city,e.e_price from Owner o ,Estate e
where o.o_no=e.o_no and o.o_city='pune' and o.o_no=wn;
begin
for x in c1 loop
dbms_output.put_line(x.e_no||' '||x.e_type||' '||x.e_city||' '||x.e_price);
end loop;
end;
declare
begin
p7(1);
end;
Q2)declare
cursor c1(name Estate.e_type%type)
is select e_no,e_type,e_city,e_price
from Estate
where e_type=name;
res c1%rowtype;
v_name Estate.e_type%type;
begin
for res in c1(&v_name)
loop
dbms_output.put_line(res.e_no||' '||res.e_type||' '||res.e_city||' '||res.e_price);
end loop;
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