Oracle and auto_increment/identity Oracle and auto_increment/identity oracle oracle

Oracle and auto_increment/identity


If you want a sequentially incrementing ordered values, then no, SEQUENCE is the only choice.

If you want just an identity, use SYS_GUID()


Oracle SQL Developer gives you an option to automatically create the "create or replace trigger" code that populates a table's primary key from a sequence. To do that, from the navigator tree, right-click on the table name > Trigger > Create (PK from Sequence). It does not create the sequence for you though.


You don't actually need a trigger, you can just reference the sequence's next value when you populate the new row into the table. You can even share a single sequence between multiple tables if you like.