oracle 自增列设置

序列

create sequence sq_1
minvalue 1
maxvalue 9999999999999999999999999999
start with 1
increment by 1
cache 2000;

 

触发器

create or replace trigger 触发器名字
  before insert on 表名  
  for each row
declare
  -- local variables here
begin
   SELECT sq_1.nextval
  INTO :NEW.列名
  FROM DUAL;

end 触发器名字;

 

SQL语句

insert into gd(id) values(sq_1.nextval);

 

你可能感兴趣的:(oracle 自增列设置)