oracle數(shù)據(jù)庫中ID怎么自增長(zhǎng)?
Oracle 新建自增序列號(hào)和觸發(fā)器:
CREATE SEQUENCE SEQ_TB_DataApproval
INCREMENT BY 1 -- 每次加幾個(gè) START WITH 1 -- 從1開始計(jì)數(shù) NOMAXVALUE -- 不設(shè)置最大值 NOCYCLE -- 一直累加,不循環(huán) NOCACHE -- 不建緩沖區(qū)create or replace trigger TRIGGER_TB_DataApproval before insert on TB_DataApproval for each row declare -- local variable here begin -- Column "ID" uses sequence di_test_id select SEQ_TB_DataApproval.nextval into :new.ID from dual; end TRIGGER_TB_DataApproval;