1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| create or replace procedure detaille
is
compt int :=1;
nbelement int:='select count(*) from detailcommande';
idcome detailcommande.idcom%TYPE;
idpre detailcommande.idpr%TYPE;
cursor detail is select idcom,idpr from detailcommande;
sommequantite number(8);
begin
open detail;
loop
fetch detail into idcome,idpre ;
exit when detail%NOTFOUND;
select sommequantite=quantite*prix from produit p,detailcommande d where p.idpr=d.idpr and p.idpr=idpre and idcom=idcome
update detailcommande set prixtotal=sommequantite where idpr=idpre and idcom=idcome
end loop;
close detail;
commit;
end ; |
Partager