这是3年前的一个总结了,最近发现提交的dba 这边的这种sql 比较多,
虽然没有出什么错,单还是有必要再拿出来提醒下大家,
update a set a1= (select b1 from b where a2=b2) 这样的语法还是有很多限制的。
往下接着看吧
alter session set current_schema = netmis_app
upudate nm_hardware b set b.cacti_url = ( select a.CACTI_FLUX_URL from
(select nm_server_info.id AS ID ,nm_server_info.CACTI_FLUX_URL AS CACTO_FLUX_URL
from nm_hardware,nm_server_info
where nm_hardware.id = nm_server_info.id
and nm_server_info.CACTI_FLUX_URL is not null) a where b.id=a.id)
方法一。
-- 用A 表的子段根据条件更新B表的相应数据。
---------------------- 要求 有主键做关联。
更新简单视图。 对于大数据量的更新,如果在嵌套查询中使用 USE_HASN 提示,效率在下列方法中效率最好。
update ( select a.cacti_url