首先创建自增索引....
CREATE SEQUENCE Archive_SEQ
MINVALUE 1
MAXVALUE 99999999999999
START WITH 1
INCREMENT BY 1
CACHE 20
ORDER;
MAXVALUE 99999999999999
START WITH 1
INCREMENT BY 1
CACHE 20
ORDER;
其次...针对每张表创建一个触发器
CREATE OR REPLACE TRIGGER Archive_TG
BEFORE INSERT ON Archive FOR EACH ROW
BEGIN
SELECT Archive_SEQ.NEXTVAL INTO :NEW.DAID FROM DUAL;
END;
BEGIN
SELECT Archive_SEQ.NEXTVAL INTO :NEW.DAID FROM DUAL;
END;
Archive_TG:触发器名称。
Archive:表名。
NEW.DAID:DAID为表的主键,要增长的字段名。
OK...这样就可以创建成功了!!!