56: cp_effective_date IN DATE
57: )
58: IS
59: SELECT ppf.full_name
60: FROM per_people_f ppf
61: WHERE ppf.person_id = cp_supervisor_id
62: AND cp_effective_date BETWEEN ppf.effective_start_date
63: AND ppf.effective_end_date;
64:
61: WHERE ppf.person_id = cp_supervisor_id
62: AND cp_effective_date BETWEEN ppf.effective_start_date
63: AND ppf.effective_end_date;
64:
65: supervisor_name per_people_f.full_name%TYPE;
66: BEGIN
67: OPEN c_supervisor_name (p_supervisor_id, p_effective_date);
68:
69: FETCH c_supervisor_name
196: SELECT count(*)
197: INTO l_cnt
198: FROM per_person_types ppt,
199: per_person_type_usages_f ptu,
200: per_people_f per
201: WHERE per.person_id = p_resource_id
202: AND ptu.person_id = per.person_id
203: AND ptu.person_type_id = ppt.person_type_id
204: -- AND ppt.system_person_type NOT IN ('EMP', 'EMP_APL', 'CWK') -- Bug 6486974
363: -- before/after termination and re-hire.
364: /*
365: select min(ppf.effective_start_date), max(ppf.effective_end_date)
366: into l_p_start_date, l_p_end_date
367: from per_people_f ppf, per_assignments_f paf
368: where ppf.person_id = p_resource_id
369: and paf.person_id = ppf.person_id
370: and paf.assignment_id = p_assignment_id
371: and paf.effective_start_date between ppf.effective_start_date
373: */
374:
375: /* select min(ppf.effective_start_date), max(ppf.effective_end_date)
376: into l_p_start_date, l_p_end_date
377: from per_people_f ppf,
378: per_assignments_f paf,
379: per_person_types ppt,
380: per_person_type_usages_f ptu
381: where ppf.person_id = p_resource_id
396: INTO
397: l_p_start_date, l_p_end_date
398: FROM
399: per_person_types ppt,
400: per_people_f per
401: WHERE
402: per.person_id = p_resource_id
403: AND ppt.person_type_id = per.person_type_id
404: AND ppt.system_person_type in ('EMP','EMP_APL','CWK')
403: AND ppt.person_type_id = per.person_type_id
404: AND ppt.system_person_type in ('EMP','EMP_APL','CWK')
405: AND per.effective_start_date =
406: (select min(perMin.effective_start_date)
407: from per_people_f perMin
408: where perMin.person_id = per.person_id
409: AND perMin.effective_start_date <= p_end_date
410: AND perMin.effective_end_date >= p_start_date)
411: AND EXISTS ( SELECT 'x'
431: SELECT MIN (per.effective_start_date), MAX (per.effective_end_date)
432: INTO l_p_start_date, l_p_end_date
433: FROM per_person_type_usages_f ptu,
434: per_person_types ppt,
435: per_people_f per
436: WHERE per.person_id = p_resource_id
437: AND ptu.person_id = per.person_id
438: AND ptu.person_type_id = ppt.person_type_id
439: AND ppt.system_person_type IN ('EMP', 'EMP_APL', 'CWK')
438: AND ptu.person_type_id = ppt.person_type_id
439: AND ppt.system_person_type IN ('EMP', 'EMP_APL', 'CWK')
440: AND (per.effective_start_date =
441: (SELECT MIN (permin.effective_start_date)
442: FROM per_people_f permin
443: WHERE permin.person_id = per.person_id
444: AND permin.effective_start_date <= p_end_date
445: AND permin.effective_end_date >= p_start_date)
446: OR
445: AND permin.effective_end_date >= p_start_date)
446: OR
447: per.effective_start_date =
448: (SELECT MAX(permin.effective_start_date)
449: FROM per_people_f permin
450: WHERE permin.person_id = per.person_id
451: AND permin.effective_start_date <= p_end_date
452: AND permin.effective_end_date >= p_start_date)
453: )