TP4.sql
create or replace FUNCTION nombre_intervention(emp in EMPLOYE.NUMEMPLOYE%type)
RETURN NUMBER
IS
cursor cr is select I.numEmploye, E.nomEmploye , E.prenomEmploye, COUNT(*) as nbr
            from INTERVENANTS I,EMPLOYE E
            where E.numEmploye=emp
            AND I.NUMEMPLOYE=E.NUMEMPLOYE
            group by I.numEmploye, E.nomEmploye, E.prenomEmploye;
   c cr%rowtype ;
    vide EXCEPTION;
begin
    FOR C IN cr loop
    DBMS_OUTPUT.PUT_LINE
    ('L emplyé : '||c.nomEmploye|| ' ' ||c.prenomEmploye||' a fait '||c.NBR||' inteventions.');
    RETURN(c.nbr);
    end loop;
   EXCEPTION when vide then
    dbms_output.put_line('Aucun employe trouvé');
end;
/  
select nombre_intervention(59 ) from dual;