创建一个序列:
CREATE SEQUENCE AUTO_SEQ INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE;
创建一个触发器,当对DEPARTMENTS表插入数据时触发该触发其自动累计插入数值到DEP_ID列
CREATE TRIGGER AUTO_INCREMENT BEFOREINSERT ON DEPARTMENTS FOR EACH ROWBEGIN SELECT AUTO_SEQ.NEXTVAL INTO:NEW.DEP_ID FROM DUAL; END;