Oracle - Modify an existing table to auto-increment a column

前端 未结 2 1362
孤街浪徒
孤街浪徒 2021-01-13 11:56

I have a table with the following column:

NOTEID      NUMBER NOT NULL,

For all intents and purposes, this column is the primary key. This

2条回答
  •  时光取名叫无心
    2021-01-13 12:45

    If your MAX(noteid) is 799, then try:

    CREATE SEQUENCE noteseq
        START WITH 800
        INCREMENT BY 1
    

    Then when inserting a new record, for the NOTEID column, you would do:

    noteseq.nextval
    

提交回复
热议问题