Protected by Copyscape Web Copyright Protection Software

Pages

Search This Blog

Thursday, March 27, 2014

SQL Query to fetch Element entry names and Values for employees for a given supervisor

SELECT PETF.ELEMENT_NAME "Element Entry Name" ,
PApF3.full_name supervisor,
PAPF.FULL_NAME "Employee Name" ,
PEEVF.EFFECTIVE_START_DATE "Entry Start Date" ,
PEEVF.EFFECTIVE_END_DATE "Entry End Date" ,
PEEVF.SCREEN_ENTRY_VALUE "Entry Values"
FROM PAY_ELEMENT_TYPES_F PETF ,
PAY_ELEMENT_LINKS_F PELF ,
PAY_ELEMENT_ENTRIES_F PEEF ,
PER_ALL_ASSIGNMENTS_F PAAF ,
PER_ALL_PEOPLE_F PAPF ,
PAY_ELEMENT_ENTRY_VALUES_F PEEVF ,
PAY_INPUT_VALUES_F PIVF
,per_all_people_f papf2
,per_all_people_f papf3
WHERE 1 = 1
--AND PETF.ELEMENT_NAME = '&Entry_Name'
AND PELF.ELEMENT_TYPE_ID = PETF.ELEMENT_TYPE_ID
AND PEEF.ELEMENT_TYPE_ID = PETF.ELEMENT_TYPE_ID
AND TRUNC(SYSDATE) BETWEEN TRUNC(PEEF.EFFECTIVE_START_DATE) AND TRUNC(PEEF.EFFECTIVE_END_DATE)
AND PAAF.ASSIGNMENT_ID = PEEF.ASSIGNMENT_ID
AND TRUNC(SYSDATE) BETWEEN TRUNC(PAAF.EFFECTIVE_START_DATE) AND TRUNC(PAAF.EFFECTIVE_END_DATE)
AND PAPF.PERSON_ID = PAAF.PERSON_ID
AND PAPF.CURRENT_EMP_OR_APL_FLAG = 'Y'
AND TRUNC(SYSDATE) BETWEEN TRUNC(PAPF.EFFECTIVE_START_DATE) AND TRUNC(PAPF.EFFECTIVE_END_DATE)
AND PEEVF.ELEMENT_ENTRY_ID = PEEF.ELEMENT_ENTRY_ID
AND PIVF.INPUT_VALUE_ID = PEEVF.INPUT_VALUE_ID
and papf2.person_id=paaf.person_id
AND paaf.primary_flag = 'Y'
AND paaf.assignment_type = 'E'
AND paaf.supervisor_id = papf3.person_id
AND papf3.current_employee_flag = 'Y'
AND papf2.business_group_id = paaf.business_group_id
AND SYSDATE BETWEEN papf2.effective_start_date AND papf2.effective_end_date
AND SYSDATE BETWEEN papf3.effective_start_date AND papf3.effective_end_date
AND PApF3.full_name=nvl(:P_SUPERVISOR,PApF3.full_name)
AND PEEVF.EFFECTIVE_START_DATE=nvl(:P_PAY_START_DATE,P EEVF.EFFECTIVE_START_DATE)
AND PEEVF.EFFECTIVE_END_DATE=nvl(:P_PAY_END_DATE,PEEVF .EFFECTIVE_END_DATE) 

No comments:

Post a Comment