You are on page 1of 2

C1:

set SERVEROUTPUT ON;


delcare
cursor c is select *from avion where nbvol >= (select 25+avg(nbvol) from avion );
vavion Avion %Rowtype;
begin
for L in C Loop
DBMS_OUTPUT.PUT_LINE('N :'||L.nuavion||' annserv : '||L.annserv);
End Loop;
End;

C2:
set SERVEROUTPUT ON;
delcare
cursor C is select nom,ville from pilote where sal >2500;
begin
for L in C Pilote Loop
DBMS_OUTPUT.PUT_LINE('nom: '||L.nom||' ville : '||L.ville);
end loop;
End;

C3:=C1

C4:
set SERVEROUTPUT ON;
declare
cursor C(psal Pilote.sal%type,tc pilote.comm/type) is select nom,embauche from
pilote where sal > psal and comm <(tc*sal);
// cursor C(psal Pilote.sal%type,tc pilote.comm/type) is select
nom,embauche from pilote where sal > 25000 and comm <(0,2*sal);
begin
open C(25000,0,2)// open C
for L in C Pilote Loop
DBMS_OUTPUT.PUT_LINE('nom: '||L.nom||' embauche : '||L.embauche);
end loop;
End;

C5:

D1:

create view v_pilote


as
select * from PILOTE
where VILLE in 'paris'

D2:

UPDATE v_pilote set sal=sal+1.1 where nopilote =1;

D3:
create view dervol
as
select avion,max(datevol)as der_vol from affectation group by avion;

D4:

create view cr_pilote


as
select *from PILOTE where (ville='paris' and comm is not null)
or (ville!='paris' and comm is null)
with check option;

D5:

create view nomcomm


as
select *from PILOTE where (nopilote in (select pilote from affectation )
and comm is not null)
or (nopilote not in (select pilote from affectation)
and comm is null)
with check option;

You might also like