Bonjour,
j'ai cette requette
Code : Sélectionner tout - Visualiser dans une fenêtre à part
select DEPTNO,count(*) from emp group by DEPTNO;
qui m'affiche résultat suivant:
DEPTNO||COUNT(*)
30||6
20||5
10||3

je veux créer une procédure qui tester si un nombre donner n'est pas existe dans DEPTNO il m'affiche une message(avec exception)
je fait cette méthode mais toujours affiche non :/

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CREATE OR REPLACE PROCEDURE SUPP(vnocde IN number)
is
CURSOR cr IS select DEPTNO,count(*) from emp group by DEPTNO;
ex exception;
BEGIN
FOR i IN cr
LOOP
if i.deptno!=vnocde then
raise ex;
end if;
end loop;
exception
when ex then
DBMS_OUTPUT.PUT_LINE('Non');
end;