update inm_trans t set t.use_direct = ( select NVL(w.item_no , 'xxx') from pds_item w where w.note=t.use_direction ) where t.use_direct is null上面的SQL是没有任何问题的. 如果t表很多的话: 就是select * from inm_trans t where t.use_direct is null 都很慢. 那只有加其他条件, 或者看看use_direct 是否是索引.
where t.use_direct is null
必然引起t表的全表扫描
set t.use_direct =
(
select NVL(w.item_no , 'xxx')
from pds_item w
where w.note=t.use_direction
)
where t.use_direct is null上面的SQL是没有任何问题的.
如果t表很多的话:
就是select * from inm_trans t where t.use_direct is null
都很慢.
那只有加其他条件,
或者看看use_direct 是否是索引.