0% found this document useful (1 vote)
2K views

Oracle Workflow Pending Approval Query

The document contains an SQL query that selects data from various tables including WF_NOTIFICATIONS, WF_ITEM_TYPES_TL, WF_LOOKUPS_TL, and HR_API_TRANSACTIONS. It retrieves notification data for a user, including status, dates, type and other details. The query uses UNION to combine results for notifications where the user is the recipient or where they are requested for more information. It orders the results by begin date descending.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views

Oracle Workflow Pending Approval Query

The document contains an SQL query that selects data from various tables including WF_NOTIFICATIONS, WF_ITEM_TYPES_TL, WF_LOOKUPS_TL, and HR_API_TRANSACTIONS. It retrieves notification data for a user, including status, dates, type and other details. The query uses UNION to combine results for notifications where the user is the recipient or where they are requested for more information. It orders the results by begin date descending.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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