I have an oracle table with a unique id
column. When I insert data into the table, I increment the last id
.
insert into my_table vlaues((select max(id) from my_table), 'etc', 'etc');
There can be multiple processes who writes into this table simultaneously.
Auto commit is on
.
This table does not have any other unique column except id
.
When I insert a record to the table, is there a way to get the id
value the record got, after I insert the record?
As I can see, if I use select max(id) from my_table
after insert, I may not get the id used in the insert statement since someone else could have inserted another record before I issue select
.