两种方法
方法一:
用触发器
建一个序列
create sequence a_seq increment by 1 start with 100;
建一个触发器, 自动+1
create or replace trigger your_seq_tri
before insert on your_table1 for each row
declare
next_id number;
begin
select your_seq.nextval into next_id from dual;
:new.id := next_id;
end;
方法二:
建一个序列
create sequence a_seq increment by 1 start with 100;
在语句中+1
insert into tbl(id,....)
values (a_seq.nextval,....)[@more@]
方法一:
用触发器
建一个序列
create sequence a_seq increment by 1 start with 100;
建一个触发器, 自动+1
create or replace trigger your_seq_tri
before insert on your_table1 for each row
declare
next_id number;
begin
select your_seq.nextval into next_id from dual;
:new.id := next_id;
end;
方法二:
建一个序列
create sequence a_seq increment by 1 start with 100;
在语句中+1
insert into tbl(id,....)
values (a_seq.nextval,....)[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/1697933/viewspace-965514/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/1697933/viewspace-965514/