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;

 

posted @ 2020-01-17 15:50  xtjatswc  阅读(267)  评论(0编辑  收藏  举报