oracle 多表关联后update
发布网友
我来回答
共1个回答
热心网友
目测是由于cdr_Cdr500_10@tocdr远程连接导致,改写成下面句子试试:
update find_ratable_lost_nbr_26 f
set f.ratable_type = 2
where exists(with t as (select /*+materialize*/chargedparty
from cdr_cdr500_10@tocdr a
where cyclebegintime >=
to_char(sysdate, 'YYYYMM') || '01000000')
select 1
from t
where f.service_nbr = substr(chargedparty, 3))
and exists (select 1
from ratable_history r
where r.base_resource_code =
f.累积量标识1
and r.owner_id =
f.ofr_inst_id
and r.owner_type =
f.owner_type
and r.billing_cycle_id =
to_char(sysdate,
'YYYYMM') || '00')
and f.owner_type = '80C';
如果效果不明显,可以考虑将远程dr_cdr500_10表需要的数据拿到本地,然后再做更新操作
以上。
追问还是不行。直接查询
SELECT * FROM cdr_Cdr500_10@tocdr c
where cyclebegintime >=to_char(sysdate, 'YYYYMM') || '01000000';
速度都是很快的,cost = 2
应该不需要同步到本地了吧。数据都在内网局域网内访问。
追答本地建临时表,把远程数据有选择的提取到临时表里,试试看怎么样