Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> SQL connundrum. Can it be done?
I need to update a table with the output of a select statement like I listed
below. The problem is that I expect my select to have about 7,000,000 rows
returned so I want to update only one column in the table for all 7,000,000
rows. I was told you can't do it easily with SQL. I would either need PL/SQL or
use SQL to generate 7,000,000 seperate update statements. Not efficient enough
for me.
Sooooo... my challenge to you is, can I accomplish my multi-row update with
standard old SQL statements? Thanks. To complicate matters one of my tables in
the join is actually a select statement inline view.
update xyz_table x
set x.id3 =
(select t.id3
from xyz_table x,
(select distinct id1, id2 from xyz_tmp_table where criteria_id='9998') t where x.criteria_id ='9999' and <--- This is my subselect where clause
x.id1 = t.id1 and x.id2 = t.id2 and x.id3 is null) where x.criteria_id = '9999' and <--- This is my update where clause x.id1 = t.id1 and x.id2 = t.id2 and x.id3 is null;Received on Wed Jul 30 2003 - 22:40:39 CDT
![]() |
![]() |