Error in trigger
I created the trigger above:
create or replace
TRIGGER informa_alteracao
BEFORE UPDATE ON tab1
for each row
declare
campo_old,campo_new tab2.ds%TYPE;
BEGIN
if (:new.campo <> :old.campo) then
select ds into campo_old
from tab2
where campo = :old.campo;
select ds into campo_new
from tab2
where campo = :new.campo;
mensagem := "Setor antigo : " ||campo_old||"\n";
mensagem := mensagem || "Setor novo : "||campo_new||"\n";
envia_email_sgrh('email@servidor.com.br','Alteracao de Setor',mensagem);
end if;
END;
When I compilo, I get the errors above:
2/12 PLS-00103: Encountered the symbol "," when expecting one of the
following:
create or replace
TRIGGER informa_alteracao
BEFORE UPDATE ON tab1
for each row
declare
campo_old,campo_new tab2.ds%TYPE;
BEGIN
if (:new.campo <> :old.campo) then
select ds into campo_old
from tab2
where campo = :old.campo;
select ds into campo_new
from tab2
where campo = :new.campo;
mensagem := "Setor antigo : " ||campo_old||"\n";
mensagem := mensagem || "Setor novo : "||campo_new||"\n";
envia_email_sgrh('email@servidor.com.br','Alteracao de Setor',mensagem);
end if;
END;
When I compilo, I get the errors above:
2/12 PLS-00103: Encountered the symbol "," when expecting one of the
following:
0