Auto-increment in Oracle without using a trigger

后端 未结 9 1967
野的像风
野的像风 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:44

    You can create and use oracle sequences. The syntax and details are at http://www.techonthenet.com/oracle/sequences.php

    Also read the article http://rnyb2.blogspot.com/2006/02/potential-pitfall-with-oracle-sequence.html to understand the limitations with respect to AUTONUMBER in other RDBMS

    0 讨论(0)
  • 2020-11-28 10:46

    If you don't need sequential numbers but only a unique ID, you can use a DEFAULT of SYS_GUID(). Ie:

    CREATE TABLE xxx ( ID RAW(16) DEFAULT SYS_GUID() )
    
    0 讨论(0)
  • 2020-11-28 10:48

    As far as I can recall from my Oracle days, you can't achieve Auto Increment columns without using TRIGGER. Any solutions out there to make auto increment column involves TRIGGER and SEQUENCE (I'm assuming you already know this, hence the no trigger remarks).

    0 讨论(0)
提交回复
热议问题