1.建立序列
CREATE SEQUENCE SWASPOADPRODINFO_SEQUENCE
increment by 1 -- 每次递增1
start with 1 -- 从1开始
nomaxvalue -- 没有最大值
minvalue 1 -- 最小值=1
NOCYCLE; -- 不循环
2.建立触发器
CREATE OR REPLACE TRIGGER SWASPOADPRODINFO_trigger
BEFORE INSERT ON SWASPOADPRODINFO
FOR EACH ROW
BEGIN
SELECT "SWASPOADPRODINFO_SEQUENCE".nextval INTO :new.ID FROM dual;
END;