oracle如何实现自增?----用序列sequence的方法来实现

--创建序列
CREATE sequence SEQ_AspNetUserClaims minvalue 1 maxvalue 999999999999999999999999999 START WITH 206 INCREMENT BY 1 cache 20;


--创建触发器
CREATE 
    OR REPLACE TRIGGER "AspNetUserClaims_TRI" BEFORE INSERT ON "AspNetUserClaims" FOR EACH ROW
BEGIN
    SELECT
        SEQ_AspNetUserClaims.NEXTVAL INTO :NEW."Id"
    FROM
    DUAL;
END;

    SELECT
        SEQ_AspNetUserClaims.
    FROM
    DUAL;

 

上一篇:oracle-函数


下一篇:DUAL系列