Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Renumber a set of grupped rows?
Just out of curiocity, and while I am trying to learn about Row_NUMBER(),
how would you code the following to do an update on the 2nd column?
>select deptno, row_number() over (PARTITION BY DEPTNO order by deptno) x
>from emp
thx
maa
> > the analytical functions are available in 8i > (..) wrap then in "execute immediate" within PL/SQL > > An update is possible in PL/SQL but it's easier to create a new table and > swap them around - unless that creates some major headaches for you.
At 08:04 PM 1/20/2004, you wrote:
>Maryann
>
>SQL> select deptno, row_number() over (PARTITION BY DEPTNO order by
>deptno) x from emp
> 2 ;
>
> DEPTNO X
>---------- ----------
> 10 1
> 10 2
> 10 3
> 20 1
> 20 2
> 20 3
> 20 4
> 20 5
> 30 1
> 30 2
> 30 3
> 30 4
> 30 5
> 30 6
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Maryann Atkinson INET: maryann_30_at_yahoo.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Jan 21 2004 - 09:04:50 CST