Oracle创建序列和触发器

3/7/2017来源:SQL技巧人气:749

-- Create sequence 序列 create sequence P_id minvalue 0 maxvalue 9999999999999999999999999999 start with 54787617 increment by 1 cache 20;

---触发器

CREATE OR REPLACE TRIGGER P_TRR_ID BEFORE

INSERT ON Person REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare nextid number; begin select P_id.nextval into :new.ID from sys.dual; end P_TRR_ID; --