Vous êtes sur la page 1sur 3

Q1://Procédures

create procedure AJOUT_PILOTE


(ppilote in PILOTE%Rowtype) is
begin
insert into pilote values ppilote;
End;
/
// pour insert
declare
vpilote pilote%Rowtype;
begin
vpilote.nopilote:=33;
vpilote.nom:=mohamed;
.
.
.
AJOUT_PILOTE (vpilote);
End;
/

Q2:

create procedure SUPPRIME_PILOTE


(pnopilote in PILOTE%Rowtype) is
begin
delete pilote
where nopilote=pnopilote;

End;
/

Q3:

Ex1 Exception
nbvol number:=0;
begin
select count(*) into nbvol
from affectation
where pilote =pnopilote;
if nbvol=0 then
delete pilote
where nopilote=pnopilote;
else
rain Ex1;
Endif;
Exception
where Ex1 then
DBMS.....('pilote des vol');
where ?? then
DBMS.....('Ex1 inl');
End;

Q4:

create procedure AFFICHE_PILOTE_N


(N number)is
Cursor C is select nom from pilote;
begin
for L in C Loop
if C%Rowcount<=N then
DBMS /*output putline*/ (L.nom);
endif;
End Loop;
End;/

Q5: //Fonctions
1)

create Function HMOYEN_VOL (ptype number) return number is


VnbHvol number;
begin
select AVG(nbHvol)is VnbHvol
from Avion
where type=ptype;
return VnbHvol ;
End;/

2)

create Function CONVERSION //simple

Q6: //Packages

1)

create package GEST_PILOTE is


procedure affichage pilote ;
procedure ...;
Function Ahpilote return number;
procedure supprime pilote(pnopilote number);
Function nbmoyennevol(ptype number ) return number;
procedure modifier (pnopilote number, pnom varchar...);
End GEST_PILOTE ;

Vous aimerez peut-être aussi