Oracle自增序列

create sequence table_name_seq minvalue 1 maxvalue 999999999999999999999999999 start with 1 increment by 1 cache 100; CREATE OR REPLACE TRIGGER tri_table_name BEFORE INSERT ON table_name FOR EACH ROW BEGIN IF (:new.col_name IS NULL ) THEN SELECT table_name_seq.nextval INTO :new.col_name FROM DUAL; END IF; END; /

你可能感兴趣的:(Oracle自增序列)