Conforme código abaixo, esotu tentando utilizar o resultado de uma variável em uma condição para um insert... Porém, o banco está dando mensagem de trigger inválida:
(ORA-04098: trigger is invalid and failed re-validation)
"v_cpf"
na condição do "if"
testando o resultado da consulta select cgc_cpf from EMPRESA
?OBS.: código original foi reduzido para facilitar a visualização
create or replace trigger trg_func_inc
after insert on pfunc
for each row
declare
v_cpf VARCHAR2(11);
begin
select
cpf
into
v_cpf
from ppessoa
where codigo =:new.codpessoa;
if (v_cpf not in (select cgc_cpf from EMPRESA)) then
insert into EMPRESA
(CGC_CPF)
VALUES
(v_cpf);
else
update EMPRESA
se SITUACAO = 'A'
where CGC_CPF = v_cpf;
end if;
end trg_func_inc;