Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

SELECT *

FROM (select /*+ ORDERED PUSH_SUBQ USE_NL (WN WL WIT) index(WN


WF_NOTIFICATIONS_N1)*/
hr_absutil_ss.getApprovalStatus(p_transaction_id =>hat.transaction_id
,p_absence_attendance_id =>1 ) getApprovalStatus,
hr_absutil_ss.getStartDate(p_transaction_id => hat.transaction_id,
p_absence_attendance_id => 5061) StartDate,
hr_absutil_ss.getEndDate(p_transaction_id => hat.transaction_id,
p_absence_attendance_id => 5061) getEndDate,
hr_absutil_ss.getAbsenceType(p_transaction_id =>
hat.transaction_id,
p_absence_attendance_id => 5061)
getAbsenceType,
wn.from_user,
wn.to_user,
WN.Item_Key,
WN.NOTIFICATION_ID,
DECODE(WN.MORE_INFO_ROLE,
NULL,
WN.SUBJECT,
FND_MESSAGE.GET_STRING('FND', 'FND_MORE_INFO_REQUESTED') || ' ' ||
WN.SUBJECT) AS SUBJECT,

nvl(WN.SENT_DATE, WN.BEGIN_DATE) BEGIN_DATE,


WN.DUE_DATE,
WN.STATUS,
WN.PRIORITY * -1 AS PRIORITY,
'P' AS PRIORITY_F,
WN.RECIPIENT_ROLE,
WN.END_DATE,
WIT.DISPLAY_NAME AS TYPE,
WN.MORE_INFO_ROLE,
WN.FROM_ROLE,
WN.MESSAGE_TYPE,
WN.MESSAGE_NAME,
WN.MAIL_STATUS,
WN.ORIGINAL_RECIPIENT
from WF_NOTIFICATIONS WN,
WF_ITEM_TYPES_TL WIT,
WF_LOOKUPS_TL WL,
HR_API_TRANSACTIONS hat
where 1 = 1 --WN.STATUS = 'OPEN'
and wn.item_key = hat.item_key
and WN.message_type = WIT.name
and WIT.language = userenv('LANG')
and WL.lookup_type = 'WF_NOTIFICATION_STATUS'
and WN.status = WL.lookup_code
and WL.language = userenv('LANG')
and WN.recipient_role in
(select WUR.role_name
from WF_USER_ROLES WUR
where WUR.user_name = 'SYSADMIN')
and more_info_role is null
and WIT.DISPLAY_NAME = 'HR'
union all
select /*+ ORDERED PUSH_SUBQ USE_NL (WN WL WIT) index(WN
WF_NOTIFICATIONS_N6)*/
hr_absutil_ss.getApprovalStatus(p_transaction_id =>hat.transaction_id
,p_absence_attendance_id =>1 ) getApprovalStatus,
hr_absutil_ss.getStartDate(p_transaction_id => hat.transaction_id,
p_absence_attendance_id => 5061) StartDate,
hr_absutil_ss.getEndDate(p_transaction_id => hat.transaction_id,
p_absence_attendance_id => 5061) getEndDate,
hr_absutil_ss.getAbsenceType(p_transaction_id =>
hat.transaction_id,
p_absence_attendance_id => 5061)
getAbsenceType,
wn.from_user,
wn.to_user,
WN.Item_Key,
WN.NOTIFICATION_ID,
DECODE(WN.MORE_INFO_ROLE,
NULL,
WN.SUBJECT,
FND_MESSAGE.GET_STRING('FND', 'FND_MORE_INFO_REQUESTED') || ' ' ||
WN.SUBJECT) AS SUBJECT,
nvl(WN.SENT_DATE, WN.BEGIN_DATE) BEGIN_DATE,
WN.DUE_DATE,
WN.STATUS,
WN.PRIORITY,
'P' AS PRIORITY_F,
WN.RECIPIENT_ROLE,
WN.END_DATE,
WIT.DISPLAY_NAME AS TYPE,
WN.MORE_INFO_ROLE,
WN.FROM_ROLE,
WN.MESSAGE_TYPE,
WN.MESSAGE_NAME,
WN.MAIL_STATUS,
WN.ORIGINAL_RECIPIENT
from WF_NOTIFICATIONS WN,
WF_ITEM_TYPES_TL WIT,
WF_LOOKUPS_TL WL,
HR_API_TRANSACTIONS hat
where WN.STATUS = 'OPEN'
and wn.item_key = hat.item_key
and WN.message_type = WIT.name
and WIT.language = userenv('LANG')
and WL.lookup_type = 'WF_NOTIFICATION_STATUS'
and WN.status = WL.lookup_code
and WL.language = userenv('LANG')
and WN.more_info_role in
(select WUR.role_name
from WF_USER_ROLES WUR
where WUR.user_name = 'SYSADMIN')) QRSLT
where 1 = 1
-- and Item_Key = '719148'
-- and status = 'OPEN'
ORDER BY BEGIN_DATE desc

You might also like