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
|
set serveroutput on
DECLARE
monom varchar(20);
name emp.ename%TYPE;
nblignes integer;
erreur exception;
BEGIN
monom := 'abdelmounaim';
DBMS_OUTPUT.PUT_LINE(monom);
select count(*) into nblignes from scott.emp;
if nblignes > 10 then
Raise erreur;
end if;
DBMS_OUTPUT.PUT_LINE('Le nombre de lignes dans la table emp est : '||nblignes);
accept numemp prompt "Numéro de lemployée : "
set ver off
select ename into name from scott.emp where empno= &numemp;
DBMS_OUTPUT.PUT_LINE('le nom de lemployée : '||name);
EXCEPTION
WHEN NO_DATA_FOUND then DBMS_OUTPUT.PUT_LINE('y a une erreur ici');
when erreur then DBMS_OUTPUT.PUT_LINE('y a trop de monde');
when others then DBMS_OUTPUT.PUT_LINE('y a une erreur ici');
END;
/
|