oracle 添加自增索引

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

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;

posted @ 2015-03-24 12:59  swack  阅读(1832)  评论(0编辑  收藏  举报