首页 > 代码库 > ORACLE序列触发

ORACLE序列触发

-- Create sequence
create sequence MFB_REGION_SEQ
minvalue 1
maxvalue 999999999
start with 6
increment by 1
nocache;

针对这个序列添加触发器。

CREATE OR REPLACE TRIGGER TGR_ID_MFB_REGION
BEFORE INSERT ON MFB_REGION FOR EACH ROW
BEGIN SELECT MFB_REGION_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; END;