Aqui uma dica para fazer suas exceções com base no código do erro. Sabemos que existem tratamentos pré-definidos, como abaixo:
Mas caso precise tratar algum em específico, faça como abaixo:
Declare uma variável do tipo EXCEPTION e na segunda linha defina o código do erro a esta variável. No caso abaixo, o erro 2292 é um erro de integridade (constraint):
1 2 3 | DECLARE minha_exception EXCEPTION; PRAGMA EXCEPTION_INIT(minha_exception, -2292); |
O resto é comum, faça a exceção. Se tentarmos deletar um registro que possui filho, entra na exceção:
1 2 3 4 5 6 | BEGIN DELETE FROM TABELA WHERE PK = 10; EXCEPTION WHEN minha_exception THEN NULL; END; |
Fácil, não?

#1 by Cost of Absence on 10/01/2012 - 2:14
Less than 37% of employers surveyed by the IRS were able to offer figures on the cost of absence in their organization. Many of those don’t consider many of the direct or indirect effects on productivity caused by sickness absence.