Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting update?
Thorsten,
Remember that in relational theory, you never know nor can depend on the physical order of rows in a table, thus an update with a sorted order seem to be oxymoron.
However, if you must replace position with a new ordering, then here are TWO solutions, one is PL/SQL, the other is an UPDATE:
Cursor C is
SELECT Rownum NEWPOS, OrgRowID
FROM
(SELECT DISTINCT SALARY,NAME,ROWID ORGROWID FROM EMP);
Update EMP a
set a.POS =
(Select NEWPOS
From
(Select rownum NEWPOS, OrgRowID FROM (Select Distinct Salary,Name, Rowid OrgRowId From EMP) c ) b
Robert Proffitt
Beckman Coulter
Brea California
RTProffitt AT beckman DOT com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Tue Sep 21 1999 - 15:12:28 CDT
![]() |
![]() |