情况是这样,A库的用户名和表空间分别为SH , SH
把业务表SH所有数据从A库,导入到B库, 表空间为SH,用户名为SP
在B库里面执行sql查询语句出现错误ORA-00942:表或视图不存在
语句为: 这里看出是因为用户变的原因,所以程序端需要进行用户变更
select sum(temp.lrs) from (select sum(a.lrs) lrs from (select count(distinct f.r026) crs from sh.fb01 f where f.f002 = 1 and f.f004 = 1 and f.if_big_donation = '0' and exists (select 1 from sh.c01 c where c.r001 = f.r001 and c.ownership = '1') group by r001) a union all select count(distinct x.r026) ljzcrs from sh.fb01 x where q002 = 1 and r001 in (select b.r001 from sh.f01 a, sh.fc02 b where a.r001 = b.acr001 and a.r012 = '1' and a.r011 = '0' and b.aaa110 = '2' and a.ownership = '2') and x.if_big_donation = '0') temp
业务语句不用管,重点是sh用户
修正语句为: 表名前缀换成sp
select sum(temp.lrs) from (select sum(a.ljzcrs) lrs from (select count(distinct f.acr026) lrs from sp.fb01 f where f.f002 = 1 and f.f004 = 1 and f.if_big_donation = '0' and exists (select 1 from sp.c01 c where c.r001 = f.r001 and c.ownership = '1') group by acr001) a union all select count(distinct x.r026) ljzcrs from sp.b01 x where q002 = 1 and acr001 in (select b.acr001 from sp.f01 a,sp.c02 b where a.r001 = b.r001 and a.r012 = '1' and a.r011 = '0' and b.aaa110 = '2' and a.ownership = '2') and x.if_big_donation = '0') temp