Exceptions
Exceptions
PL – SQL -LMD
EXCEPTION
EXCEPTIONS
Exceptions
Utilisateurs
Anonymes
(-20000 et -20999)
1
08/12/2021
EXCEPTIONS
Syntaxe
Declare
...
Begin
…
Exception
WHEN <nom_exception> [OR <nom_exception>…]
THEN <instruction_plsql>;
…
[WHEN OTHERS THEN <instructions_plsql>;]
End;
2
08/12/2021
PORTÉE EXCEPTION
3
08/12/2021
SQLCODE
Permet de retrouver le code des exceptions Oracle
SQLERRM
Permet de retrouver le message des exceptions
Oracle
4
08/12/2021
EXCEPTIONS ANONYMES
5
08/12/2021
PRAGMA EXCEPTION_INIT
Fonction:
Permet d’associer une exception utilisateur à un code d’erreur Oracle.
Syntaxe:
Declare
<nom_exception> Exception;
Pragma Excpetion_init (<nom_excpetion>,<code_erreur_oracle>);
Begin
Exception
WHEN <nom_exception> THEN
<istruction_plsql>;
End;
PRAGMA EXCEPTION_INIT
6
08/12/2021
EXCEPTION UTILISATEUR
Declare
<nom_exception> Exception;
Begin
RAISE <nom_exception>
Exception
WHEN <nom_exception> THEN
<istruction_plsql>;
End;
EXCEPTION UTILISATEUR
7
08/12/2021
MERCI DE
VOTRE
ATTENTION