Re: Sorting a column

From: Dan Blum <tool_at_panix.com>
Date: Thu, 7 Aug 2008 15:11:09 +0000 (UTC)
Message-ID: <g7f3ad$nh0$2@reader1.panix.com>


digory <digory_at_gmx.net> wrote:
> I just tried the following

> UPDATE T
> SET pos = DENSE_RANK () OVER (ORDER BY name)

> Unfortunately, this does not work because Oracle does not allow
> analytic functions in the SET clause.

update t

   set pos =

       (select new_id
          from (select rowid, dense_rank() over (order by name) new_id
                  from t) t2
         where t2.rowid = t.rowid); 

-- 
_______________________________________________________________________
Dan Blum					         tool_at_panix.com	
"I wouldn't have believed it myself if I hadn't just made it up."
Received on Thu Aug 07 2008 - 10:11:09 CDT

Original text of this message