oracle数据库表实现主键自增功能
有关oracle中自增序列sequence+触发器trigger:实现数据表TABDATA_LIVE_CYCLE中的主键id的自增。
CREATE SEQUENCE TABDATA_LIVE_CYCLE_SEQ
MINVALUE 0
MAXVALUE 9999999999999999999999999999
INCREMENT BY 1
START WITH 1
CACHE 20
NOORDER
NOCYCLE ;
CREATE OR REPLACE TRIGGER TABDATA_LIVE_CYCLE_SEQ_ID_ART
before insert on TABDATA_LIVE_CYCLE
for each row
begin
select TABDATA_LIVE_CYCLE_SEQ.nextval into :new.id from dual;
end ;
/