Maybe just like this even though it could take a while ?
SQL> update employee
2 set supervisor = department
3 where company = 10
4 and employee = employee;
-----Original Message-----
From: Mark Richards
[mailto:oracledba-ezmlmshield-x87758652.[Email address protected]
Sent: Tuesday, August 17, 2004 2:39 PM
To: LazyDBA Discussion
Subject: RE: Best update clause
I've personally had better luck with this kind of update to do the join,
build a cursor, and then update the employee table as you go. It looks like
you could just update the employee table once per supervisor, so it may not
be that many updates.
Mark
-----Original Message-----
From: bralston
[mailto:oracledba-ezmlmshield-x15549405.[Email address protected]
Sent: Tuesday, August 17, 2004 1:31 PM
To: LazyDBA Discussion
Subject: Best update clause
All, I have a very large table (8 million rows) that I need to update and
was wondering the best sql.
I need to set the column (supervisor) equal to the column (department) in
the table. I'm not even sure I have the clause right. Anyhelp would be
appreciated.
Sql :
update employee e
set e.supervisor = (select d.department
from employee d
where d.company=10
and d.company = e.company
and d.department= e.department
and d.employee = e.employee)
where e.company = 10;
or
update employee e
set e.supervisor = e.department
where company = 10;
thanks,
Brad
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page