Sunday 18 November 2018

Query to find terminated employees in oracle apps

Query to find terminated employees in oracle apps

In this post , We will be discuss about sql query to find the terminated employees in oracle apps. Terminated employee is which whose period of service is end dated or whose employment has been ended in the system. To find the terminated employees in oracle apps system , We need to use one important 'per_periods_of_service' table which helps of store the Employment track in oracle apps.Here below I will share the Tables and the sql Query to find terminated employees in oracle apps.

Query to find terminated employees in oracle apps

2 Basic Tables of sql Query of Employee Termination

1. per_all_people_f
2.per_periods_of_service


Complete SQL Query to find terminated employees in oracle apps


select papf.employee_number "Employee Number",
papf.title "Title",
papf.first_name "First Name",
papf.last_name "Last Name",
papf.national_identifier,
papf.email_address "E-mail",
TO_CHAR(papf.effective_start_date, 'DD-MON-RRRR') "Start Date",
TO_CHAR(papf.effective_end_date, 'DD-MON-RRRR') "End Date",
TO_CHAR(papf.original_date_of_hire, 'DD-MON-RRRR') "Hire Date"
from apps.per_all_people_f papf
, apps.per_periods_of_service ppos
WHERE 1=1
AND papf.person_id = ppos.person_id
AND ppos.period_of_service_id = (SELECT MAX(period_of_service_id
FROM per_periods_of_service
WHERE person_id = papf.person_id)
AND ppos.actual_termination_date < TRUNC(SYSDATE)

3 comments:

Unknown said...

ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 13 Column: 1

Anonymous said...

select papf.employee_number "Employee Number",
papf.title "Title",
papf.first_name "First Name",
papf.last_name "Last Name",
papf.national_identifier,
papf.email_address "E-mail",
TO_CHAR(papf.effective_start_date, 'DD-MON-RRRR') "Start Date",
TO_CHAR(papf.effective_end_date, 'DD-MON-RRRR') "End Date",
TO_CHAR(papf.original_date_of_hire, 'DD-MON-RRRR') "Hire Date"
from apps.per_all_people_f papf
, apps.per_periods_of_service ppos
WHERE 1=1
AND papf.person_id = ppos.person_id
AND ppos.period_of_service_id = (SELECT MAX(period_of_service_id)
FROM apps.per_periods_of_service
WHERE person_id = papf.person_id)
AND ppos.actual_termination_date < TRUNC(SYSDATE)

Unknown said...

I guess this should work if you're trying to get the most recent termination date.
If you need the complete history then you'll need to bring in per_all_assignments_f to get the correct period_of_service_id to use in apps.per_periods_of_service.

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *