rash
rash

Reputation: 21

How do I rearrange a non continuous seq number in an Oracle table

I have a table with some values and a seq column which orders the values and this gets displayed in the front end, so whenever I delete a record using a function, this seq is not arranged properly.

i.e.

col1:
1
2
3
4
5

after deletion of 2nd and 4th record. It comes as:

Col1:
1
3
5

I tried possible ways to re-order it as:

Col1:
1
2
3..

but its not working can some one please help in this?

Upvotes: 1

Views: 26

Answers (1)

Abhijith Nagarajan
Abhijith Nagarajan

Reputation: 4030

I hope you are not talking about updating a primary key which is a very bad idea.

Otherwise you can do this

update table set col1 = rownum;

Upvotes: 1

Related Questions