-1
Create OR Replace TRIGGER filme_log
before Update OF custo On filme
Referencing New As New Old As Old
For Each Row 
Begin 
Insert into filme_log Values(:new.nome_original, :old.custo, :new.custo, sysdate);
END;

Este é o meu trigger e isto está a funcionar.

Begin
Update filme set custo = 9876546 where nome_original = 'UP';
Commit;
Declare
Cursor filme_log_cur is
Select nomeF,custo_old,custo_new, data
From filme_log;
nomeF_cur filme_log.nomeF%type;
custo_old_cur filme_log.custo_old%type;
custo_new_cur filme_log.custo_new%type;
data_cur filme_log.data%type;
Begin
Open filme_log_cur;
Loop Fetch filme_log_cur into nomeF_cur, custo_old_cur, custo_new_cur, data_cur;
EXIT WHEN filme_log_cur%notfound;
DBMS_Output.put_line('Dados inseridos em Filme_log:');
DBMS_Output.put_line(nomeF_cur || '  ' ||custo_old_cur || '  ' ||custo_new_cur || '  ' || data_cur);
END LOOP;
END;

E eu estou a tentar correr este trigger mas não consigo perceber porque que não está a funcionar.

5
  • João, você está no Stack Overflow em Português, traduza a sua pergunta por favor. 19/12/2019 às 17:03
  • Welcome to StackOverflow in Portuguese. As the name implies, the official language used here is Portuguese. So, can you please translate your question? If you prefer, you may also ask this same question in the English StackOverflow site. 19/12/2019 às 17:07
  • Bem-vindo ao StackOverflow em português. Tal como o nome sugere, o idioma oficial usado aqui é o português. Assim sendo, você poderia por favor traduzir sua pergunta? Caso prefira, você também pode fazer essa mesma pergunta no site em inglês do StackOverflow. 19/12/2019 às 17:08
  • Qual banco de dados você esta utilizando?
    – Erick Luz
    19/12/2019 às 17:15
  • Estamos a usar o ORACLE. 19/12/2019 às 17:18

1 Resposta 1

1

O problema pode ser que a trigger esteja desabilitada.

Primeiro verifique se a trigger esta habilitada usando:

SELECT STATUS FROM USER_TRIGGERS WHERE TRIGGER_NAME = 'filme_log';

Se estiver desabilitada, habilite usando:

ALTER TRIGGER filme_log ENABLE;

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .