Blz galera…
sou programador Dlephi a mais de 10 anos e estou começando no mundo Oracle agora e gostaria de saber como faço para tratar uma exceção no trigger sem que o Oracle me envie a mensagem que Eu padronizer + as suar mensagens… Assim:
create or replace
TRIGGER “SPDATA”.”TRG_DEL_RICADPAC” BEFORE
DELETE ON “SPDATA”.”RICADPAC” REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW Declare t_pront_e integer;
excecao exception;
pragma exception_init(excecao,-20001);
t_pront_i integer;
t_pacuni char(1);
cursor c1 is
select pac_uni from reparam;
cursor c2 is
Select max(pront) from recadate where pront=:old.pront and otmu=:old.otmu;
cursor c3 is
Select max(pront) from ricadint where pront=:old.pront and otmu=:old.otmu;
BEGIN
dbms_output.enable;
open c1;
fetch c1 into t_pacuni;
close c1;
if (t_pacuni = ‘F’) then
open c2;
fetch c2 into t_pront_e;
close c2;
end if;
If (t_pacuni = ‘T’) then
open c3;
fetch c3 into t_pront_i;
close c3;
open c2;
fetch c2 into t_pront_e;
close c2;
end if;
If (((t_pacuni = ‘F’) and (t_pront_e is not null)) or
((t_pacuni = ‘T’) and ((t_pront_i is not null) or (t_pront_e is not null)))) then
raise excecao;
end if;
exception
when excecao then
RAISE_APPLICATION_ERROR(-20001,’Erro de exclusão: prontuário com atendimento/internação’);
raise;
end;
Ele sempre me devolve as mensagens abaixo:
ora-06512 0ra-04088
Alguém sabe como não enviar estas mensagens, pois, não gostaria de tratar todas no programa.