Although you've had a row-at-a-time version from someone, you might try something like the following if you can't do a "create as select" to rebuild the original data.
Create table temp pctfree 0 nologging as select rowid e_rowid, row_number() over (PARTITION BY DEPTNO order by deptno) x from emp; create unique index t_i on temp(e_rowid); alter table temp modify e_rowid not null; update emp e set req_id = ( select x from temp t where t.e_rowid = e.rowid ); (Just making it up as I go along, so I won't guarantee that it works). Regards Jonathan Lewis http://www.jlcomp.demon.co.uk The educated person is not the person who can answer the questions, but the person who can question the answers -- T. Schick Jr Next public appearance2: March 2004 Hotsos Symposium - Keynote March 2004 Charlotte NC - OUG Tutorial April 2004 Iceland One-day tutorials: http://www.jlcomp.demon.co.uk/tutorial.html Three-day seminar: see http://www.jlcomp.demon.co.uk/seminar.html ____UK___February The Co-operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html ----- Original Message ----- To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Wednesday, January 21, 2004 3:04 PM > 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 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jonathan Lewis INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).