Path: text.usenetserver.com!out03b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!nlpi057.nbdc.sbc.com!prodigy.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!transit4.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
From: "Shakespeare" <whatsin@xs4all.nl>
Newsgroups: comp.databases.oracle.misc
References: <1210a149-d43e-48a8-bbd7-9a688c96fa88@y38g2000hsy.googlegroups.com>
Subject: Re: [Q] Sorting a column
Date: Fri, 8 Aug 2008 08:58:50 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Lines: 27
Message-ID: <489beea6$0$49829$e4fe514c@news.xs4all.nl>
NNTP-Posting-Host: 82.95.215.210
X-Trace: 1218178726 news.xs4all.nl 49829 [::ffff:82.95.215.210]:49693
X-Complaints-To: abuse@xs4all.nl
Xref: usenetserver.com comp.databases.oracle.misc:253479
X-Received-Date: Fri, 08 Aug 2008 02:58:46 EDT (text.usenetserver.com)


"digory" <digory@gmx.net> schreef in bericht 
news:1210a149-d43e-48a8-bbd7-9a688c96fa88@y38g2000hsy.googlegroups.com...
> Hi
>
> I have a table T with two columns NAME (VARCHAR2) and POS (NUMBER). I
> want to write an UPDATE query, which updates the column POS such that
> its values correspond to the alphabetical order of NAME.
>
> UPDATE
>   T t1
> SET pos = (SELECT ROWID FROM T t2 WHERE t1.NAME = t2.NAME ORDER BY
> NAME)
>
> That does not work, because the WHERE clause returns a single row,
> which will always have a ROWID of 1.
>
> How do I do this? (It's possible with a PROCEDURE, of course, but I
> want to avoid them.)

ROWID? Don't you mean rownum?
I don't think tables will ever have rows with the same rowid (except by 
coincidence)

Shakespeare 


