0% found this document useful (0 votes)
12 views

Terminated Emp SQL

This SQL query selects employee data from multiple tables including employee ID, name, termination date, and reason for employees who terminated before the current date.

Uploaded by

niyaz99
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Terminated Emp SQL

This SQL query selects employee data from multiple tables including employee ID, name, termination date, and reason for employees who terminated before the current date.

Uploaded by

niyaz99
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SELECT papf.person_id,papf.

person_number
,ppnf.full_name
,to_char(ppos.actual_termination_date, 'dd-mon-
yyyy','NLS_DATE_LANGUAGE=ENGLISH') termination_date
,part.action_reason termination_reason
FROM per_all_people_f papf
,per_person_names_f ppnf
,per_periods_of_service_v ppos
,per_action_reasons_tl part
,per_action_occurrences pao
WHERE papf.person_id =ppnf.person_id
AND papf.person_id =ppos.person_id
AND UPPER(ppnf.name_type)='GLOBAL'
AND TO_CHAR(ppos.actual_termination_date,'dd-mm-yyyy')<TO_CHAR(SYSDATE,'dd-mm-
yyyy')
AND ppos.action_occurrence_id = pao.action_occurrence_id
AND pao.action_reason_id = part.action_reason_id
AND part.language = USERENV('LANG')
AND TRUNC(SYSDATE) BETWEEN TRUNC(papf.effective_start_date) AND
TRUNC(papf.effective_end_date)
AND TRUNC(SYSDATE) BETWEEN TRUNC(ppnf.effective_start_date) AND
TRUNC(ppnf.effective_end_date)

You might also like