1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
create or replace procedure CalculCA()
as
cursor CAcur is
select nomstation,TO_NUMBER(datefin-datedebut) as nbjours ,tarifjour
from station s,reservations r,location l
where s.idstation=r.idstation
and l.idlocation=r.idlocation
and nomstation='TIGNES'
order by nomstation;
CA number(10,0);
Vnom varchar2(20);
Vdate number(10,0);
Vtarif number(10,0);
begin
CA := 0;
open CAcur;
FETCH CAcur INTO Vnom,Vdate,Vtarif;
while CAcur%FOUND
LOOP
CA := (CA+(Vdate*Vtarif));
FETCH CAcur INTO Vnom,Vdate,Vtarif;
end loop;
close CAcur;
/* DBMS_OUTPUT.PUT_LINE( 'Chiffre d affaire -> ' || CA ) ; */
/* DBMS_OUTPUT.PUT( ' ' || 'Nom Station=' || Vnom ) ; */
end;
/ |