复制代码 代码如下:
create table Test_Table
(
ID number(11) primary key,
Name varchar(50) not null,
Value1 varchar(50) not null
)
复制代码 代码如下:
create sequence AutoID
start with 1 //根据需要自己可修改该数值
increment by 1 //步长值
minvalue 1
nomaxvalue
复制代码 代码如下:
Insert into Test_Table(ID,Name,Value1)values(AutoID.nextval,'xiyang','blog')
复制代码 代码如下:
create trigger AutoID_Trigger
before insert on Test_Table for each row
begin
select AutoID.nextval into :new.ID from dual;
end AutoID_Trigger;
新闻热点
疑难解答