1.添加一个Sequence,此处为ID_SEQUENCE。

oracle 添加自增索引

2.添加对应表,并设置主键

 

3.设置触发器

create or replace trigger sys.id_add
before insert on SWACK.NUSER
for each row
-- WHEN (new.id is null)
-- local variables here
begin
select SWACK.ID_SEQUENCE.NEXTVAL into :new.id from dual;
end id_add;

相关文章:

  • 2021-10-01
  • 2021-12-17
  • 2021-08-20
  • 2021-09-15
  • 2021-08-17
  • 2022-01-07
猜你喜欢
  • 2022-03-02
  • 2022-01-13
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2021-10-25
  • 2022-02-07
相关资源
相似解决方案