Path: text.usenetserver.com!out03a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!cycny01.gnilink.net!cyclone1.gnilink.net!gnilink.net!nx02.iad01.newshosting.com!newshosting.com!post01.iad01!not-for-mail
Date: Fri, 08 Aug 2008 12:26:31 -0700
From: DA Morgan <damorgan@psoug.org>
Organization: Puget Sound Oracle Users Group
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.misc
Subject: Re: [Q] Sorting a column
References: <1210a149-d43e-48a8-bbd7-9a688c96fa88@y38g2000hsy.googlegroups.com> <489beea6$0$49829$e4fe514c@news.xs4all.nl>
In-Reply-To: <489beea6$0$49829$e4fe514c@news.xs4all.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <1218223583.133026@bubbleator.drizzle.com>
Cache-Post-Path: bubbleator.drizzle.com!unknown@dsl-216-162-218-178.drizzle.com
X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
Lines: 34
X-Complaints-To: abuse@csolutions.net
Xref: usenetserver.com comp.databases.oracle.misc:253487
X-Received-Date: Fri, 08 Aug 2008 15:26:23 EDT (text.usenetserver.com)

Shakespeare wrote:
> "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 

Not even by coincidence ... it is a technical impossibility.
-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
