SYSTEMTI.NET

Please or Cadastrar to create posts and topics.

trigger para proibir atendimento por convênio e TP atendimento (pode-se incrementar especialidade :new.cd_especialid))

PROMPT CREATE OR REPLACE TRIGGER trg_hsman_bloq_atend
CREATE OR REPLACE TRIGGER trg_hsman_bloq_atend

BEFORE INSERT OR UPDATE ON atendime
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF :new.cd_convenio = 1 AND :new.tp_atendimento = 'A' THEN
raise_application_error( -20001, 'CONVENIO NAO PERMITIDO');
END IF;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);

END;
/

Marcos Soares has reacted to this post.
Marcos Soares