Bonsoir tous,

J'ai écrit une fonction sous oracle qui permet de supprimer un chercheur à partir de son numéro, en voici le code :
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
16
17
18
19
20
21
22
23
24
25
create or replace FUNCTION Suppression(num in number)  return varchar
IS
c_table chercheur%rowtype; 
cursor cr is select numCh from chercheur; 
c_rec cr%rowtype; 
i binary_integer;
inexistant EXCEPTION; 
BEGIN
i := 1;
for c_rec in cr loop 
if(c_rec.numch=num) then
 delete from chercheur where c_rec.numch = num;
return('Le chercheur a été supprimé');
else
i:=i+1;
exit when cr%notfound;
end if; end loop;
if(i<2) then RAISE inexistant;
else
i := i-1;
end if;
EXCEPTION WHEN inexistant THEN
return('Le chercheur nexiste pas');
END;
/
le problème qui se pose est comment exécuter cette fonction
j'ai essayé la commande suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
select Suppression(2) from dual;
Mais oracle m'affiche une erreur :
ERREUR à la ligne 1 :
ORA-14551: impossible d'effectuer une opération DML dans une interrogation
ORA-06512: à "SGBD.SUPPRESSION", ligne 12
Quelqu'un peut-il m'aider s'il-vous-plaît ?

Merci.