trigger para atualizar o TP atendimento e TP acidente na versão 2.02 do TISS
Citação de andre.pegorin em 25/11/2022, 13:01PROMPT CREATE OR REPLACE TRIGGER trg_hsman_atualiza_tp_tiss
CREATE OR REPLACE TRIGGER trg_hsman_atualiza_tp_tissBEFORE INSERT OR UPDATE ON atendime
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF :new.cd_convenio = 191 AND :new.tp_atendimento = 'U' THEN
:new.TP_ACIDENTE_TISS := '2';
:new.TP_ATENDIMENTO_TISS := '4';
END IF;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);END;
/
PROMPT CREATE OR REPLACE TRIGGER trg_hsman_atualiza_tp_tiss
CREATE OR REPLACE TRIGGER trg_hsman_atualiza_tp_tiss
BEFORE INSERT OR UPDATE ON atendime
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF :new.cd_convenio = 191 AND :new.tp_atendimento = 'U' THEN
:new.TP_ACIDENTE_TISS := '2';
:new.TP_ATENDIMENTO_TISS := '4';
END IF;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);
END;
/