Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting update?
That's because what you are trying to do would violate the nature of
relational databases. One of the reasons for having a relational database
is to make the actual order of storage irrelvant while providing sql to
allow you to extract data in the order that you want.
Thorsten Koch wrote:
> > Hi folks! > > Let there be table EMP with > POS NUMBER > NAME VARCHAR2 > SAL NUMBER > > and the data > POS NAME SAL > ----- ------ ----- > 1 A 1000 > 2 C 500 > 3 B 700 > > Now I want to update the table in a way that its sorted by salaries, so > that it looks like this: > > POS NAME SAL > ----- ------ ----- > 1 C 500 > 2 B 700 > 3 A 1000 > > That is, I would like to have an update-statement like > > update emp > set pos=(select rownum > from emp > order by sal); > > Unfortunately, it is not possible to use "order by" in an update > statement. > > Can someone advise me how to perform this task? I would be glad to > receive a few different solutions, because not all solutions may fit to > my special application.Received on Tue Sep 21 1999 - 13:50:20 CDT
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------
![]() |
![]() |