oracle數據庫中ID怎么自增長?
Oracle 新建自增序列號和觸發器:
CREATE SEQUENCE SEQ_TB_DataApproval
INCREMENT BY 1 -- 每次加幾個 START WITH 1 -- 從1開始計數 NOMAXVALUE -- 不設置最大值 NOCYCLE -- 一直累加,不循環 NOCACHE -- 不建緩沖區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;