----------job details query-----------------
--------parameters
1.p_grade 2.p_job_set
----------list of values
-------job set lovSELECT DISTINCT set_name
FROM fnd_setid_sets_vl
------grade lovSELECT DISTINCT NAME
FROM per_grades_f_vl
WHERE active_status = 'A'
ORDER BY 1
----------------main query
SELECT DISTINCT job.job_code,
job.NAME "Job Name",
pgf.grade_id,
To_char(job.effective_start_date,'MM/DD/YYYY') "EFFECTIVE START DATE",
To_char(job.effective_end_date,'MM/DD/YYYY') "EFFECTIVE END DATE",
pgf.grade_code,
st.set_code,
st.set_name,
(
SELECT To_char(sysdate,'DD/MM/YYYY')
FROM dual) sys,
pgf.NAME "Grade Name"
FROM per_jobs_f_vl JOB,
per_valid_grades_f vgf,
per_grades_f_vl pgf,
fnd_setid_sets st
WHERE job.job_id = vgf.job_id(+)
AND vgf.grade_id = pgf.grade_id (+)
AND job.set_id = st.set_id (+)
--and job.JOB_CODE in ('0003')
AND job.active_status = 'A'
AND ((
pgf.NAME) IN (:p_Grade)
OR 'All' IN (:p_Grade
|| 'All'))
AND ((
st.set_name ) IN (:p_job_set)
OR 'All' IN (:p_job_set
|| 'All'))
--and pgf.grade_id is null
AND sysdate BETWEEN job.effective_start_date AND job.effective_end_date
AND sysdate BETWEEN pgf.effective_start_date(+) AND pgf.effective_end_date(+)
AND sysdate BETWEEN vgf.effective_start_date(+) AND vgf.effective_end_date(+)
ORDER BY job.job_code
----------------parametersSELECT Nvl(
(
SELECT DISTINCT set_name
FROM fnd_setid_sets_vl
WHERE 1=1
AND set_name = :p_job_set
AND rownum = 1 ),'ALL') Job_set,
Nvl(
(
SELECT DISTINCT NAME
FROM per_grades_f_vl
WHERE NAME = :p_Grade),'ALL') PE_GRADE
FROM dual
No comments:
Post a Comment