0% found this document useful (0 votes)
61 views20 pages

Alert Details

The document contains several SQL queries that are selecting data from various tables in an HR database. The queries are retrieving employee information like employee numbers, names, job titles, locations, hire dates, etc. Some of the queries have filters to return employees whose probation period is ending, who were recently hired, or whose employment is ending. The overall purpose seems to be gathering employee data for various HR-related alerts and notifications.

Uploaded by

Adnan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views20 pages

Alert Details

The document contains several SQL queries that are selecting data from various tables in an HR database. The queries are retrieving employee information like employee numbers, names, job titles, locations, hire dates, etc. Some of the queries have filters to return employees whose probation period is ending, who were recently hired, or whose employment is ending. The overall purpose seems to be gathering employee data for various HR-related alerts and notifications.

Uploaded by

Adnan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Birthday wishes alert

SELECT employee_number, first_name||' ' ||last_name " Employee Name"


, date_of_birth, email_address
INTO &emp_Num, &emp_name, &dob, &emp_email
FROM apps.per_all_people_f
WHERE trunc(sysdate) between effective_start_date and effective_end_date
AND to_char(to_date(date_of_birth),'dd') = to_char(to_date(sysdate),'dd') AND
to_char(to_date(date_of_birth),'mm') = to_char(to_date(sysdate),'mm')
AND email_address IS NOT NULL
and current_employee_flag = 'Y';
Actions
Action Details
Actions Sets
Action Set Details
Outputs

Members
Alert Details

Outputs
Installations
Blank Supervisor

SELECT
papf.employee_number
,papf.first_name||' '||Papf.last_name "Name"
--,paaf.Supervisor_ID "Supervisor "
,job.NAME "Job"
,papf.Email_Address "Email"
,Loc.location_code "Location"

into
&emp_Num, &emp_name, &Job , &Email, &Loc

FROM
apps.PER_ALL_PEOPLE_F papf
,apps.PER_ALL_ASSIGNMENTS_F paaf
,apps.HR_LOCATIONS_V loc
,apps.PER_JOBS_VL Job

Where
papf.person_id = paaf.person_id
and
PAAF.location_id = loc.LOCATION_ID
and
paaf.JOB_ID = job.JOB_ID

AND papf.effective_end_date = '31-dec-4712'


AND to_date(sysdate,'DD-Mon-RRRR') Between paaf.Effective_Start_Date AND
paaf.Effective_End_Date
AND papf.person_type_id = 1126
AND papf.employee_number IS NOT NULL
AND paaf.Supervisor_ID IS NULL
Order By papf.employee_number
Creation and Updation of internee

SELECT d.Business_Group_ID, d.Sex, d.Full_Name,


d.Date_Employee_Data_Verified,
d.Effective_Start_Date, d.Person_Type_ID,
d.Date_Of_Birth,
d.National_Identifier,
d.Created_By, u.User_Name, d.Creation_Date,
ROUND((TO_DATE(d.Attribute6,'dd-MON-yyyy')-d.Effective_Start_Date)/7,0) Weeks,
d.Attribute5
INTO
&Business_Group_ID, &Sex, &Full_Name,
&Date_Employee_Data_Verified,
&Effective_Start_Date, &Person_Type_ID,
&Date_Of_Birth, &National_Identifier,
&Created_By, &User_Name, &Creation_Date, &Weeks,
&Attribute5
FROM PER_ALL_PEOPLE_F d, FND_User u
WHERE d.Created_By = u.User_ID
AND d.PERSON_TYPE_ID = 2118
AND d.BUSINESS_GROUP_ID=82
AND d.Attribute5 IS NOT NULL
AND d.rowid=:rowed
Employee Creation Alert

SELECT papf.employee_number employee_number,


REPLACE(InitCap(papf.Title)||' '||papf.First_Name||' '||papf.Middle_Names||' '||
papf.Last_Name, ' ', ' ') employee_name,
papf.email_address employee_email,
papf.National_Identifier employee_CNIC,
to_char(paaf.CREATION_DATE, 'dd-mm-yyyy hh') creation_date,
LOC.DESCRIPTION LOCATION,
GRD.NAME GRADE,
JB.NAME JOB
INTO &employee_number,
&employee_name,
&employee_email,
&employee_CNIC,
&creation_date,
&LOCATION,
&Grade,
&JOB
FROM apps.per_all_people_f papf,
apps.per_all_assignments_f paaf,
apps.per_grades_vl Grd,
apps.HR_LOCATIONS_V loc ,
apps.per_Jobs_vl JB

WHERE papf.business_group_id = 82
AND papf.business_group_id = paaf.business_group_id
AND paaf.PERSON_ID = papf.PERSON_ID
AND PAAF.JOB_ID = JB.JOB_ID (+)
AND PAAF.LOCATION_ID = LOC.LOCATION_ID (+)
AND PAAF.GRADE_ID = GRD.GRADE_ID (+)
AND papf.person_id = paaf.person_id
AND paaf.organization_id = '82'
--AND paaf.Grade_ID is null

and papf.person_type_id = (select t.person_type_id


from apps.per_person_types t
where t.user_person_type = 'Employee'
and t.person_type_id = papf.person_type_id
and t.business_group_id= papf.business_group_id)
AND paaf.primary_flag = 'Y'
AND TRUNC(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND TRUNC(sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
-- AND to_char(sysdate, 'dd-mm-yyyy hh') = to_char(paaf.CREATION_DATE, 'dd-mm-yyyy hh')
AND papf.rowid=:rowid;
Employee Creation Alert – Detail

SELECT papf.employee_number employee_number,


REPLACE(InitCap(papf.Title)||' '||papf.First_Name||' '||papf.Middle_Names||' '||
papf.Last_Name, ' ', ' ') employee_name,
papf.email_address employee_email,
papf.National_Identifier employee_CNIC,
to_char(paaf.CREATION_DATE, 'dd-mm-yyyy') creation_date,
LOC.DESCRIPTION LOCATION,
GRD.NAME GRADE,
JB.NAME JOB
INTO &employee_number,
&employee_name,
&employee_email,
&employee_CNIC,
&creation_date,
&LOCATION,
&Grade,
&JOB
FROM apps.per_all_people_f papf,
apps.per_all_assignments_f paaf,
apps.per_grades_vl Grd,
apps.HR_LOCATIONS_V loc ,
apps.per_Jobs_vl JB

WHERE papf.business_group_id = 82
AND papf.business_group_id = paaf.business_group_id
AND paaf.PERSON_ID = papf.PERSON_ID
AND PAAF.JOB_ID = JB.JOB_ID (+)
AND PAAF.LOCATION_ID = LOC.LOCATION_ID (+)
AND PAAF.GRADE_ID = GRD.GRADE_ID (+)
AND papf.person_id = paaf.person_id
AND paaf.organization_id = '82'
--AND paaf.Grade_ID is null

and papf.person_type_id = (select t.person_type_id


from apps.per_person_types t
where t.user_person_type = 'Employee'
and t.person_type_id = papf.person_type_id
and t.business_group_id= papf.business_group_id)
AND paaf.primary_flag = 'Y'
AND TRUNC(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND TRUNC(sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND to_char(sysdate, 'dd-mm-yyyy hh') = to_char(paaf.CREATION_DATE, 'dd-mm-yyyy hh')
AND paaf.grade_id is not null and paaf.job_id is not null
-- AND papf.rowid=:rowid;
End Of Internship Period
SELECT papf.employee_number employee_number,
REPLACE(InitCap(papf.Title)||' '||papf.First_Name||' '||papf.Middle_Names||' '||
papf.Last_Name, ' ', ' ') employee_name,
papf.email_address employee_email,
papf.National_Identifier employee_CNIC,
to_char(paaf.CREATION_DATE, 'dd-mm-yyyy hh') creation_date,
LOC.DESCRIPTION LOCATION,
GRD.NAME GRADE,
JB.NAME JOB
INTO &employee_number,
&employee_name,
&employee_email,
&employee_CNIC,
&creation_date,
&LOCATION,
&Grade,
&JOB
FROM apps.per_all_people_f papf,
apps.per_all_assignments_f paaf,
apps.per_grades_vl Grd,
apps.HR_LOCATIONS_V loc ,
apps.per_Jobs_vl JB

WHERE papf.business_group_id = 82
AND papf.business_group_id = paaf.business_group_id
AND paaf.PERSON_ID = papf.PERSON_ID
AND PAAF.JOB_ID = JB.JOB_ID (+)
AND PAAF.LOCATION_ID = LOC.LOCATION_ID (+)
AND PAAF.GRADE_ID = GRD.GRADE_ID (+)
AND papf.person_id = paaf.person_id
AND paaf.organization_id != '82'
--AND paaf.Grade_ID is null

and papf.person_type_id = (select t.person_type_id


from apps.per_person_types t
where t.user_person_type = 'Employee'
and t.person_type_id = papf.person_type_id
and t.business_group_id= papf.business_group_id)
AND paaf.primary_flag = 'Y'
AND TRUNC(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND TRUNC(sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
-- AND to_char(sysdate, 'dd-mm-yyyy hh') = to_char(paaf.CREATION_DATE, 'dd-mm-yyyy hh')
AND papf.rowid=:rowid;
End of Employment

select DISTINCT
PAPF.Employee_number
,PAPF.FIRST_NAME||' '||PAPF.MIDDLE_NAMES||''||PAPF.LAST_NAME EMP_NAME
,PAPF.NATIONAL_IDENTIFIER
,JOB.NAME JOB
,GRADE.NAME GRADE
,LOC.DESCRIPTION LOC
,to_char(PAPF.ORIGINAL_DATE_OF_HIRE, 'DD-MON-YYYY') "Date of Joining"
,to_char(POS.ACTUAL_TERMINATION_DATE, 'DD-MON-YYYY') "Last Working Day"

INTO
&EMP_NO
&EMP_NAME
&CNIC
&JOB
&GRADE
&LOC
&Date_of_Joining
&Last_Working_Day

FROM
APPS.PER_ALL_PEOPLE_F PAPF
,APPS.per_all_assignments_F PAAF
,APPS.HR_LOCATIONS_V LOC
,APPS.PER_PERIODS_OF_SERVICE POS
,APPS.PER_JOBS_VL JOB
,APPS.PER_GRADES_VL GRADE

WHERE
PAPF.PERSON_ID = PAAF.PERSON_ID
AND
PAAF.LOCATION_ID = LOC.LOCATION_ID
AND
PAAF.JOB_ID = JOB.JOB_ID
AND
PAAF.GRADE_ID = GRADE.GRADE_ID
AND
POS.PERSON_ID = PAPF.PERSON_ID
AND
TRUNC (SYSDATE) BETWEEN PAPF.EFFECTIVE_START_DATE AND PAPF.EFFECTIVE_END_DATE
AND
TRUNC (SYSDATE) BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE
AND
POS.ACTUAL_TERMINATION_DATE >= TO_DATE(sysdate, 'DD-Mon-RRRR')
End of Probation 10-Sep-2018

SELECT p.Business_group_ID,
to_char(p.Effective_End_Date,'YYYY') Year,
p.Effective_End_Date,
p.Employee_Number,
p.Full_Name,
p.Person_ID,
p.Effective_Start_Date,
p.Marital_Status,
p.National_Identifier,
p.Sex,
a.Date_Probation_End,
s.Full_Name Supervisor_Full_Name,
s.Email_Address Supervisor_Email_Address
INTO
&Business_group_ID,
&Year,
&Effective_End_Date,
&Employee_Number,
&Full_Name,
&Person_ID,
&Effective_Start_Date,
&Marital_Status,
&National_Identifier,
&Sex,
&Date_Probation_End,
&Supervisor_Full_Name,
&Supervisor_Email_Address
FROM apps.PER_ALL_PEOPLE_F p, apps.PER_ALL_ASSIGNMENTS_F a, apps.PER_ALL_PEOPLE_F s
WHERE p.Person_ID = a.Person_ID
AND p.Employee_Number is not null
AND a.Date_Probation_End IS NOT NULL
AND a.Supervisor_ID = s.Person_ID
AND a.Business_group_ID = 82
AND p.Business_group_ID = 82
AND s.Business_group_ID = 82
AND to_char(p.Effective_End_Date,'YYYY') = 4712
AND to_char(a.Effective_End_Date,'YYYY') = 4712
--AND ROUND (a.DATE_PROBATION_END-sysdate) = 17
AND ROUND (a.DATE_PROBATION_END-sysdate) BETWEEN 1 AND 15
ORDER BY 1
End of Probation New
SELECT p.Business_group_ID,
to_char(p.Effective_End_Date,'YYYY') Year,
p.Effective_End_Date,
p.Employee_Number,
p.First_Name||' '||p.LAST_NAME NAME,
p.Original_Date_of_Hire,
p.Person_ID,
p.Effective_Start_Date,
p.Marital_Status,
p.National_Identifier,
p.Sex,
a.Date_Probation_End,
s.First_Name||' '||s.LAST_NAME Supervisor_Full_Name,
s.Email_Address Supervisor_Email_Address

INTO
&Business_group_ID,
&Year,
&Effective_End_Date,
&Employee_Number,
&Full_Name,
&Original_Date_Of_Hire,
&Person_ID,
&Effective_Start_Date,
&Marital_Status,
&National_Identifier,
&Sex,
&Date_Probation_End,
&Supervisor_Full_Name,
&Supervisor_Email_Address

FROM apps.PER_ALL_PEOPLE_F p, apps.PER_ALL_ASSIGNMENTS_F a, apps.PER_ALL_PEOPLE_F s


WHERE p.Person_ID = a.Person_ID
AND p.Employee_Number IS NOT NULL
--AND a.Date_Probation_End IS NOT NULL
AND a.Supervisor_ID = s.Person_ID
AND a.Business_group_ID = 82
AND p.Business_group_ID = 82
--AND s.Business_group_ID = 82
AND to_char(p.Effective_End_Date,'YYYY') = 4712
AND to_char(a.Effective_End_Date,'YYYY') = 4712
AND TRUNC(sysdate) BETWEEN p.Effective_Start_Date AND p.EFFECTIVE_END_DATE
AND TRUNC(sysdate) BETWEEN a.Effective_Start_Date AND a.EFFECTIVE_END_DATE
AND TRUNC(sysdate) BETWEEN s.Effective_Start_Date AND s.EFFECTIVE_END_DATE
AND (a.Employment_Category = 'DIBPLOP' OR a.Employment_Category IS NULL)
AND a.ASSIGNMENT_STATUS_TYPE_ID = 1
--AND ROUND (a.DATE_PROBATION_END-sysdate) = 17
--AND p.Employee_Number = '2371'
AND ROUND (a.DATE_PROBATION_END-sysdate) BETWEEN 1 AND 15
--AND (ROUND (a.DATE_PROBATION_END-sysdate)+1) IN (0,2,5,15)
ORDER BY p.original_date_of_hire
GL Code Required for Internet Expense
SELECT
pap.employee_number,
pap.full_name
INTO
&EMP_NO,
&EMP_NAME
FROM
PER_ALL_PEOPLE_F pap,
PER_ALL_ASSIGNMENTS_F paa
WHERE
pap.person_id = paa.person_id
AND TO_DATE(sysdate,'DD-Mon-RRRR') BETWEEN paa.Effective_Start_Date AND paa.Effective_End_Date
-- AND paa.employment_category IN ('PK_NMP','PK_MP')
-- AND paa.assignment_status_type_id = 1
AND pap.person_type_id = 1126
AND paa.default_code_comb_ID IS NULL
Order By pap.employee_number
User ID Creation

SELECT a.employee_number, a.TITLE|| ' '||a.FIRST_NAME||' '||a.LAST_NAME Emp_Name, a.FULL_NAME,


b.USER_NAME, a.EMAIL_ADDRESS, a.NATIONAL_IDENTIFIER, to_char(a.start_date, 'DD-MON-YYYY') DOJ
INTO &employee_number, &Emp_Name, &FULL_NAME,
&USER_NAME, &EMAIL_ADDRESS, &NATIONAL_IDENTIFIER, &DOJ
FROM apps.per_all_people_f a, apps.fnd_user b
WHERE a.EMPLOYEE_NUMBER = b.USER_NAME (+)
AND TRUNC (sysdate) BETWEEN a.EFFECTIVE_START_DATE AND a.EFFECTIVE_END_DATE
AND a.employee_number IS NOT NULL
-- and b.END_DATE is null and b.USER_NAME is null
AND person_Type_id <> 1130
AND to_char(sysdate, 'dd-mm-yyyy') = to_char(b.CREATION_DATE, 'dd-mm-yyyy')
-- and a.employee_number = '5290'

You might also like