Upload
deveshdashora123
View
219
Download
0
Embed Size (px)
Citation preview
create view ccc as select * from company where company_id=&cid;create cursor ddd (id in number) is
products - pno,pname,categoryid,companyid
create cursor pro_info (pid in number)select pno,pname,category_name, company_name,select sum(amount) from purchase where prono=pid,select sum(amount) from sales where prono=pid,from products, categories, companies where products.companyid=companies.compid andproducts.categoryid = categories.category_id andproducts.pno = pid;
declarecominfo company_cur%ROWTYPE;
beginOPEN company_cur(101);loop while company_cur % found
FETCH company_cur into cominfo;insert into othercompany values(cominfo.company_id, comi
nfo.company_name, cominfo.company_city);end loop;CLOSE company_cur;
end;
declarecominfo company_cur%ROWTYPE;
beginOPEN company_cur(101);loop
FETCH company_cur into cominfo;EXIT WHEN company_cur % NOTFOUND;insert into othercompany values(cominfo.company_id, cominfo.comp
any_name, cominfo.company_city);end loop;CLOSE company_cur;
end;