触发器修改后保存之前的数据 表中插入数据时ID自动增长

时间:2021-10-19 00:24:18

create or replace trigger t
before update on test5
for each row
begin
insert into test55 values (:old.id,:old.name);
end ;

--------------------------------------------------------------------------------------

--表中插入数据时ID自动增长

create table ttt (id number primary key ,name varchar2(20),age number(2))
create or replace trigger gger_tt
before insert on ttt
for each row
when (new.id is null)
begin
select ttt_sequence.nextval into :new.id from dual;
end;

insert into ttt(name) values('明')