Which command would replace IDENTITY INSERT ON/OFF from SQLServer in Oracle? Which command would replace IDENTITY INSERT ON/OFF from SQLServer in Oracle? oracle oracle

Which command would replace IDENTITY INSERT ON/OFF from SQLServer in Oracle?


You don't have to disable the identity in Oracle. Since you are using sequences, just don't use it for that insert.

That is, instead of

insert into table (id, values) values (table_seq.nextval, 2)

you use

insert into table (id, values) values (1, 2)

As to your second question about restarting the sequence, I think that is answered here in SO.


Messing with columns populated by Oracle sequences in this way seems like a Bad Idea. In Oracle, you are typically maintaining a column populated via sequences with a trigger. If you start turning this feature on and off, and resetting the sequence ad lib, you run the risk of a sequence not being available when another process needs it, or getting reset to a value that has been used already but not committed.


Drop the sequences and re-create them when you're done with the max+1 value.