Oracle資料庫多重子查詢巢狀的坑

2021-08-01 14:53:30 字數 944 閱讀 4996

**如下:

select t.*, rownum rn

from (select b.*,

nvl(a.amount, 0) amount,

v.fullname,

decode(share_type, 1, '***', 0, '%%%') share_type

from (select

count(s.comments) amount,

p.bo_problem_manage_id bo_problem_manage_id

from bo_share_comments s, bo_problem_share p

group

by p.bo_problem_manage_id) a,

bo_problem_share b,

v_user_org v

where b.bo_problem_manage_id = a.bo_problem_manage_id(+)

and b.create_userid = v.userid

and b.share_status = '2'

order

by b.create_date) t

上面**執行時,會報錯如下:

看**看了很多遍還是沒有發現錯誤,然後就是各種子查詢拆開執行還是沒有發現錯誤.

附上問題所在的:

問題說明:在b.*中有share_type,後面又有share_type的字段導致執行sql的時候區分不了欄位.建議解決方法,字段重新命名,或者不使用全表字段.

Oracle資料庫查詢

取得該使用者下所有的表 select from user tables 取得表名為classinfo的注釋資訊 select from user tab comments where table name classinfo 取得該使用者下表名為classinfo表的結構 select from u...

Oracle跨資料庫查詢

工作中需要從乙個資料庫中的表 gis weichai data 1s 中的資料匯入到另個一資料庫的表 gis weichai data 1s 中,資料庫伺服器都是遠端的 分別為 221.131.228.256 211.161.192.46 我的實現方法是在本地使用 pl sql 操作兩個遠端伺服器,...

oracle資料庫效能查詢

作為乙個開發 測試人員 或多或少都得和資料庫打交道,而對資料庫的操作歸根到底都是 sql語句,所有 操作到最後都是 運算元據 那麼對 sql效能 的掌控又成了我們 工作中一件非常重要的工作。下面簡單介紹下 一些檢視oracle 效能的一些實用方法 1 查詢每台機器的連線數 select t.mach...