Oracle:创建序列与触发器
1 创建序列(为触发器提供服务)
create sequence SEQ_USERminvalue 1maxvalue 9999999999999999999999999999start with 1increment by 1cache 20;
CREATE OR REPLACE TRIGGER TRI_USER BEFOREINSERT ON USER FOR EACH ROWDECLARE V_ID NUMBER;BEGIN SELECT SEQ_USER.NEXTVAL INTO V_ID FROM DUAL; :NEW.ID := LPAD(V_ID,5,'0');END TRI_USER;