Auto-increment in Oracle without using a trigger

后端 未结 9 1978
野的像风
野的像风 2020-11-28 09:52

What are the other ways of achieving auto-increment in oracle other than use of triggers?

9条回答
  •  死守一世寂寞
    2020-11-28 10:32

    Create a sequence:

    create sequence seq;
    

    Then to add a value

    insert into table (id, other1, other2)
    values (seq.nextval, 'hello', 'world');
    

    Note: Look for oracle docs for more options about sequences (start value, increment, ...)

提交回复
热议问题