I have created a table in oracle database which I named USERS
and I have created a column USER_ID
with type NUMBER
which i set as primary key.
How can I modify the column USER_ID
to make it auto increment by 1 ?
Any help please ?
auto-incrementoracle-12c
I have created a table in oracle database which I named USERS
and I have created a column USER_ID
with type NUMBER
which i set as primary key.
How can I modify the column USER_ID
to make it auto increment by 1 ?
Any help please ?
Best Answer
If you insist on using IDENTITY, it is not be possible - you cannot modify non-identity column to identity. However, Oracle lets you use sequence.nextval as default, so you may get similar functionality :
It will work as
GENERATED BY DEFAULT AS IDENTITY
.