Oracle触发器主键自动增长Oracle认证考试
文章作者 100test 发表时间 2009:11:24 17:16:10
来源 100Test.Com百考试题网
"tb42" class="mar10">
1,创建sequence:
create sequence SEQ_SM_USER
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
cache 20.
2,创建触发器:
create or replace trigger tg_sm_user
before insert on sm_user
referencing old as oldval
new as newval
for each row
begin
0select seq_sm_user.nextval into :newval.pk_user from dual.
end.
编辑特别推荐:
110个oracle常用函数总结