首页 > 代码库 > 序列和触发器

序列和触发器

建立序列后,还需要触发器,在插入的时候,新增自增

create sequence "seq_unit" increment by 1 start with 1 minvalue 1 maxvalue 999 cycle nocache order;
CREATE OR REPLACE TRIGGER "TRI_UNIT_BEFORE_INSERT" BEFORE       INSERT ON TBL_UNIT FOR EACH ROW BEGIN       SELECT SEQ_UNIT.NEXTVAL INTO :NEW.UNIT_ID FROM DUAL;END;

序列和触发器