Vous êtes sur la page 1sur 1

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 a nd products.categoryid = categories.category_id and products.pno = pid; declare cominfo company_cur%ROWTYPE; begin OPEN 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; declare cominfo company_cur%ROWTYPE; begin OPEN 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;

Vous aimerez peut-être aussi