psi_mmobile

Untitled

Oct 30th, 2025
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. WITH CTE AS (
  2. SELECT P_WBS.getWbsName(Wbs.WBS_ID, VGuiUserOcPoi.POI_ID) AS NAME,
  3. VGuiUserOcPoi.POI_ID,
  4. Wbs.WBS_ID,
  5. Wbs.REF_NUMBER,
  6. NVL (WBS.IS_PROJECT, 'N') IS_PROJECT,
  7. wbs.poi_tin,
  8. ROW_NUMBER() OVER (PARTITION BY WBS.name, VGuiUserOcPoi.POI_ID, Wbs.REF_NUMBER ORDER BY nvl (WBS.is_project, 'N')) as row_num,
  9. VGuiUserOcPoi.short_name as poi_short_name
  10. FROM V_GUI_USER_OC_POI VGuiUserOcPoi ,WBS Wbs
  11. where VGuiUserOcPoi.POI_ID = Wbs.POI_ID(+)
  12. and VGuiUserOcPoi.OC_POI_STATUS_ID = 0
  13. and nvl(Wbs.WBS_STATUS_ID,0) = 0
  14. and nvl (VGuiUserOcPoi.is_home_poi_category, 'N') = 'N'
  15. and VGuiUserOcPoi.oc_poi_category_id = nvl(:oc_poi_category_id, VGuiUserOcPoi.oc_poi_category_id)
  16. and (Wbs.WBS_LEVEL=1 or (Wbs.WBS_LEVEL=0 and not exists (select w.wbs_id from WBS w where nvl(w.wbs_status_id, 0) = 0 and w.wbs_level=1 and w.poi_id=Wbs.poi_id)))
  17. and VGuiUserOcPoi.GUI_USER_ID = :gui_user_id
  18. )
  19. SELECT name, wbs_id, POI_ID, REF_NUMBER, poi_tin, is_project, poi_short_name
  20. FROM CTE
  21. WHERE row_num = 1
  22. ORDER BY name, poi_id, ref_number;
Advertisement
Add Comment
Please, Sign In to add comment