Général

Syntaxe

Application Page 83

create or replace procedure compter
is 
cursor c1 is select nom_D, count(*) as  nb from 
department, employe where employer.no_dept=department.no_dep
group by nom_d;

Begin
for cptr in C1 Loop
DMBS_OUTPUT.PUT_LINE (cptr.nom_d || "," || cptr.nb);
end loop
end compter;

Application Page 84

create or replcare procedure project ( n employer.nas %type)
is 
cursor c is select nom_p from projet,traaillesure where projet.idproj=travaillesur.idproj  and n = travaillesure.nas
begin
for cpt in c loop 
dbms_output.putline(cpt nomp)
end loop
end projet;

Application Page 103

declare
cursor c is select * from employe 
var number;
E_exception;
begin 
seelct count(*) into var from employer 
if var =0 then raise E;
else 
for cpt in c loop
insert into emp_fr values (cpt.nom, cpt.prenom, cpt.nas,cpt.dnaiss, cpt.addresse, (cpt.salai/3)*1.25;
end loop;
commit;
end if;
execption
when e then 
dbms_output.putline("la table employe est vide");
end;

Triggers

Les Vues