Advertisement
psi_mmobile

Untitled

Jun 2nd, 2022
1,371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 4.51 KB | None | 0 0
  1. SELECT name,
  2.        description,
  3.        unit_name,
  4.        is_generic,
  5.        order_num,
  6.        allow_absence_request,
  7.        person_id,
  8.        lm_date,
  9.        lm_name,
  10.        from_date,
  11.        is_active,
  12.        work_code_hr_counter_id,
  13.        actual_value,
  14.        reference_value,
  15.        "{}counter_name_str_map",
  16.        "{}unit_name_str_map"
  17. FROM (
  18. (SELECT NVL(s.str_value,wcc.name) name,
  19.        wcc.description,
  20.        NVL(uom_s.str_value, uom.short_name) unit_name,
  21.        wcc.is_generic,
  22.        wcc.order_num,
  23.        wcc.allow_absence_request,
  24.        (SELECT json_objectagg(s2.language VALUE s2.str_value) FROM str s2 WHERE s2.str_id = wcc.str_id) "{}counter_name_str_map",
  25.        (SELECT json_objectagg(s3.language VALUE s3.str_value) FROM str s3 WHERE s3.str_id = uom.str_id) "{}unit_name_str_map",
  26.        pwcc.person_id,
  27.        pwcc.lm_date,
  28.        pwcc.lm_name,
  29.        pwcc.from_date,
  30.        pwcc.is_active,
  31.        pwcc.work_code_hr_counter_id,
  32.        P_VOPC_ABSENCE_MANAGMENT.f_compute_person_counter(pwcc.person_id, pwcc.work_code_hr_counter_id) actual_value,
  33.        pwcc.counter_value reference_value
  34. FROM person_work_code_counter pwcc, work_code_hr_counter wcc, unit_of_measurement uom, gui_users gu, str s, str uom_s, gu_person gp
  35. WHERE pwcc.person_id = NVL(:person_id, pwcc.person_id)
  36. AND gu.gui_user_id = gp.gui_user_id
  37. AND gp.person_id = pwcc.person_id
  38. AND pwcc.work_code_hr_counter_id = wcc.work_code_hr_counter_id
  39. AND gu.gui_user_id = :gui_user_id
  40. AND wcc.unit_of_measurement_id = uom.unit_of_measurement_id
  41. AND uom.str_id = uom_s.str_id (+)
  42. AND wcc.str_id = s.str_id (+)
  43. AND gu.language = s.language (+)
  44. AND gu.language = uom_s.language (+)
  45. AND NVL(wcc.is_generic, 'N') = DECODE(:is_generic, 'Y', 'Y', NVL(wcc.is_generic, 'N')))
  46.  
  47. UNION
  48.  
  49. (SELECT NVL(s.str_value,wcc.name) name,
  50.     wcc.description,
  51.     NVL(uom_s.str_value, uom.short_name) unit_name,
  52.     wcc.is_generic,
  53.     wcc.order_num,
  54.     wcc.allow_absence_request,
  55.     (SELECT json_objectagg(s2.language VALUE s2.str_value) FROM str s2 WHERE s2.str_id = wcc.str_id) "{}counter_name_str_map",
  56.     (SELECT json_objectagg(s3.language VALUE s3.str_value) FROM str s3 WHERE s3.str_id = uom.str_id) "{}unit_name_str_map",
  57.     pwcc.person_id,
  58.     pwcc.lm_date,
  59.     pwcc.lm_name,
  60.     pwcc.from_date,
  61.     pwcc.is_active,
  62.     pwcc.work_code_hr_counter_id,
  63.     P_VOPC_ABSENCE_MANAGMENT.f_compute_person_counter(pwcc.person_id, pwcc.work_code_hr_counter_id) actual_value,
  64.     pwcc.counter_value reference_value
  65. FROM person_work_code_counter pwcc, work_code_hr_counter wcc, unit_of_measurement uom, gui_users gu, str s, str uom_s, gu_person gp
  66. WHERE gu.gui_user_id = gp.gui_user_id
  67. AND gp.person_id = pwcc.person_id
  68. AND pwcc.work_code_hr_counter_id = wcc.work_code_hr_counter_id
  69. AND gu.profiled_person_id = :user_person_id
  70. AND pwcc.person_id != :user_person_id
  71. AND wcc.unit_of_measurement_id = uom.unit_of_measurement_id
  72. AND uom.str_id = uom_s.str_id (+)
  73. AND wcc.str_id = s.str_id (+)
  74. AND gu.language = s.language (+)
  75. AND gu.language = uom_s.language (+)
  76. AND NVL(wcc.is_generic, 'N') = DECODE(:is_generic, 'Y', 'Y', NVL(wcc.is_generic, 'N')))
  77.  
  78. UNION
  79.  
  80. (SELECT NVL(s.str_value,wcc.name) name,
  81.        wcc.description,
  82.        NVL(uom_s.str_value, uom.short_name) unit_name,
  83.        wcc.is_generic,
  84.        wcc.order_num,
  85.        wcc.allow_absence_request,
  86.        (SELECT json_objectagg(s2.language VALUE s2.str_value) FROM str s2 WHERE s2.str_id = wcc.str_id) "{}counter_name_str_map",
  87.        (SELECT json_objectagg(s3.language VALUE s3.str_value) FROM str s3 WHERE s3.str_id = uom.str_id) "{}unit_name_str_map",
  88.        pwcc.person_id,
  89.        pwcc.lm_date,
  90.        pwcc.lm_name,
  91.        pwcc.from_date,
  92.        pwcc.is_active,
  93.        pwcc.work_code_hr_counter_id,
  94.        P_VOPC_ABSENCE_MANAGMENT.f_compute_person_counter(pwcc.person_id, pwcc.work_code_hr_counter_id) actual_value,
  95.        pwcc.counter_value reference_value
  96. FROM person_work_code_counter pwcc, work_code_hr_counter wcc, unit_of_measurement uom, gui_users gu, str s, str uom_s
  97. WHERE (pwcc.person_id = :person_id OR :user_person_id = pwcc.person_id)
  98. AND pwcc.work_code_hr_counter_id = wcc.work_code_hr_counter_id
  99. AND gu.profiled_person_id = :user_person_id
  100. AND wcc.unit_of_measurement_id = uom.unit_of_measurement_id
  101. AND uom.str_id = uom_s.str_id (+)
  102. AND wcc.str_id = s.str_id (+)
  103. AND gu.language = s.language (+)
  104. AND gu.language = uom_s.language (+)
  105. AND NVL(wcc.is_generic, 'N') = DECODE(:is_generic, 'Y', 'Y', NVL(wcc.is_generic, 'N')))
  106. )
  107. ORDER BY person_id, order_num
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement