oracle執行sql查詢語句出現錯誤ORA-00942:表或視圖不存在


情況是這樣,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
 

 

 

oracle新建用戶執行sql查詢語句出現錯誤ORA-00942:表或視圖不存在


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM