1.创建自增序列
SEQUENCE为自增序列,默认为1,P_LLPS_SEQ为序列名;
CREATE SEQUENCE P_LLPS_seq;
2.为表对象创建触发器
P_LLPS_TRIGGER为触发器名,P_LLPS为需要设置自增的表名,new.id中的id为需要设置自增的字段名,其中字段名需要大写,否则会出错;
CREATE TRIGGER P_LLPS_TRIGGER BEFORE INSERT ON P_LLPS FOR EACH ROW
BEGIN
select P_LLPS_seq.nextval into :new.id from dual;
END;