0
I’m starting to mess with databases PL/SQL and I’m having a hard time creating a Trigger when inserting a row in the table, the Trigger place a value in my column whose name is token.
I made a code with what I know of DB, but when I turn it presents the following error:
(ORA-04084: não pode alterar valores NEW para este tipo de gatilho)
Follows the code:
create TABLE BancoJulianaCadastro(
codUser integer,
nome varchar(200),
senha varchar(50),
login varchar(8),
email varchar(30),
cpf number(11)
token number(20));
alter table BancoJulianaCadastro add CONSTRAINT codUser_PK PRIMARY key (codUser);
create sequence token_seq
minvalue 1
maxvalue 99999
start with 1
increment by 1;
create or replace trigger token_tgr
AFTER INSERT ON BancoJulianaCadastro
declare
sequencial number;
begin
select token_seq.NEXTVAL
into sequencial
from dual;
:new.token := sequencial;
end;