serial sorting [message #408115] |
Sun, 14 June 2009 05:38 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
owais_baba
Messages: 289 Registered: March 2008 Location: MUSCAT
|
Senior Member |
|
|
hi all
my problem is this that let suppose
serial is
sr.no
1
2---->if i deleted serial no 2
3
4
5
then serial should sort
automatically like
1
2
3
4
5
thnaks and pls find the solution
baba
|
|
|
|
Re: serial sorting [message #408476 is a reply to message #408161] |
Tue, 16 June 2009 06:35 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
owais_baba
Messages: 289 Registered: March 2008 Location: MUSCAT
|
Senior Member |
|
|
thanks for response
let me explain you again
1 -- john
2 -- rocky ------i deleted this one
3 -- martin
4 -- david
serial should sort automatically like
1 -- john
2 -- martin
3 -- david
can u give some example regarding updation
thanks
|
|
|
Re: serial sorting [message #408495 is a reply to message #408476] |
Tue, 16 June 2009 07:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I can not, because I don't know what makes those names sorted that way (John first, Rocky second, Martin third and David fourth) - it is not alphabetically (asc or desc), so - once you find out the way those names are sorted, write an UPDATE statement which should contain some kind of ORDER BY clause, such as (ordering them alphabetically descending)SQL> select * from test;
ID ENAME
---------- --------------------
david
john
martin
rocky
SQL> update test t set
2 t.id = (select x.rb
3 from (select t1.ename, row_number() over (order by t1.ename desc) rb
4 from test t1
5 ) x
6 where x.ename = t.ename
7 );
4 rows updated.
SQL> select * from test order by ename desc;
ID ENAME
---------- --------------------
1 rocky
2 martin
3 john
4 david
SQL>
By the way, what makes this question related to Forms?
|
|
|
|
|