I want to create a serial number in Oracle. I have tried this query
alter table tablename add(ID NUMBER);
CREATE SEQUENCE SEQ_ID START WITH 1 INCREMENT BY 1 MAXVALUE 31611805 MINVALUE 1 NOCYCLE;
UPDATE tablename SET ID= SEQ_ID.NEXTVAL
I have,
NID
-----
ABD90
BGJ89
HSA76
and I want:
ID NID
---------
1 ABD90
2 BGJ89
3 HSA76
Above code is not working. I am new to oracle.Please help in generating above result.
If you want to add unique ID for each NID then, you can do it this way-