字段自增长
oracle数据库id怎么实现自增长
oracle数据库id怎么实现自增长
2017-03-01
create table Test_Table
(
ID number(11) primary key,
Name varchar(50) not null
)
create sequence AutoID
start with 1 //根据需要自己可修改该数值
increment by 1 //步长值
minvalue 1
nomaxvalue
create trigger AutoID_Trigger
before insert on Test_Table for each row
begin
select AutoID.nextval into :new.ID from dual;
end AutoID_Trigger;
举报