I have to migrate this query (simplified here) from T-SQL to ORACLE
SET IDENTITY_INSERT table ON
INSERT INTO table (id, value) VALUES (1, 2)
SET IDENTITY_INSERT table OFF
id
being an Identity field in SQLServer.
I have the same table with a sequence in ORACLE, I couldn't find a snippet that shows how to disable the sequence and set it to start again with the MAX(id) + 1.
Any ORACLE expert can help me with this?
Thanks, Rodrigo.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With