Loading

oracle 建设表 ID自增

create table B_SMSTYPE
(
ID NUMBER,
TYPENAME VARCHAR2(50)
)
tablespace RENMINWANG
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);


create sequence B_SMSTYPE_SEQ
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 2000
cycle;


create or replace trigger B_SMSTYPE_TRIG before insert
on B_SMSTYPE
referencing new as new old as old
for each row
begin
select B_SMSTYPE_SEQ.nextval into :new.id from dual;
end;

posted @ 2014-04-03 15:59  The Mechanic  阅读(136)  评论(0编辑  收藏  举报