創建自動增長列
create sequence emp_sequence
increment by
minvalue
nomaxvalue
start with
cache
order;
注解
currval=返回 sequence的當前值
nextval=增加sequence的值
比如
emp_sequence
emp_sequence
插入測試數據
insert into sysrole (roleId
創建觸發器
create or replace trigger sysrole_id
before insert on sysrole
for each row
begin
select emp_sequence
end;
插入測試數據
insert into sysrole (roleName
最後
commit
From:http://tw.wingwit.com/Article/program/Oracle/201311/16909.html