首页 热点专区 义务教育 高等教育 出国留学 考研考公

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
应该不需要同步到本地了吧。数据都在内网局域网内访问。

追答本地建临时表,把远程数据有选择的提取到临时表里,试试看怎么样

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com