174: cp_org_unit_cd IGS_OR_UNIT.org_unit_cd%TYPE,
175: cp_start_dt IGS_OR_UNIT.start_dt%TYPE) IS
176: SELECT our.parent_org_unit_cd,
177: our.parent_start_dt
178: FROM IGS_OR_UNIT_REL our
179: WHERE our.child_org_unit_cd = cp_org_unit_cd and
180: our.child_start_dt = cp_start_dt and
181: our.logical_delete_dt IS NULL ; -- new validation as part of bug 2408794
182: BEGIN
326: AND IGS_OR_STATUS.s_org_status = 'ACTIVE'
327: ORDER BY IGS_OR_UNIT.institution_cd;
328:
329: CURSOR c_ou_parent (
330: cp_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
331: cp_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE) IS
332: SELECT parent_org_unit_cd,
333: parent_start_dt
334: FROM IGS_OR_UNIT_REL,
327: ORDER BY IGS_OR_UNIT.institution_cd;
328:
329: CURSOR c_ou_parent (
330: cp_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
331: cp_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE) IS
332: SELECT parent_org_unit_cd,
333: parent_start_dt
334: FROM IGS_OR_UNIT_REL,
335: IGS_OR_UNIT,
330: cp_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
331: cp_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE) IS
332: SELECT parent_org_unit_cd,
333: parent_start_dt
334: FROM IGS_OR_UNIT_REL,
335: IGS_OR_UNIT,
336: IGS_OR_STATUS
337: WHERE child_org_unit_cd = cp_org_unit_cd
338: AND child_start_dt = cp_start_dt
359:
360: -- Cursor to find all the Child Org Unit Code of the Org Units related to the Org Unit.
361: CURSOR c_our_child
362: IS
363: SELECT IGS_OR_UNIT_REL.child_org_unit_cd,
364: IGS_OR_UNIT_REL.child_start_dt,
365: IGS_OR_UNIT.institution_cd
366: FROM IGS_OR_UNIT_REL,
367: IGS_OR_UNIT,
360: -- Cursor to find all the Child Org Unit Code of the Org Units related to the Org Unit.
361: CURSOR c_our_child
362: IS
363: SELECT IGS_OR_UNIT_REL.child_org_unit_cd,
364: IGS_OR_UNIT_REL.child_start_dt,
365: IGS_OR_UNIT.institution_cd
366: FROM IGS_OR_UNIT_REL,
367: IGS_OR_UNIT,
368: IGS_OR_STATUS
362: IS
363: SELECT IGS_OR_UNIT_REL.child_org_unit_cd,
364: IGS_OR_UNIT_REL.child_start_dt,
365: IGS_OR_UNIT.institution_cd
366: FROM IGS_OR_UNIT_REL,
367: IGS_OR_UNIT,
368: IGS_OR_STATUS
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
365: IGS_OR_UNIT.institution_cd
366: FROM IGS_OR_UNIT_REL,
367: IGS_OR_UNIT,
368: IGS_OR_STATUS
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
371: AND IGS_OR_UNIT_REL.logical_delete_dt IS NULL
372: AND IGS_OR_UNIT.org_unit_cd = IGS_OR_UNIT_REL.child_org_unit_cd
373: AND IGS_OR_UNIT.start_dt = IGS_OR_UNIT_REL.child_start_dt
366: FROM IGS_OR_UNIT_REL,
367: IGS_OR_UNIT,
368: IGS_OR_STATUS
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
371: AND IGS_OR_UNIT_REL.logical_delete_dt IS NULL
372: AND IGS_OR_UNIT.org_unit_cd = IGS_OR_UNIT_REL.child_org_unit_cd
373: AND IGS_OR_UNIT.start_dt = IGS_OR_UNIT_REL.child_start_dt
374: AND IGS_OR_STATUS.org_status = IGS_OR_UNIT.org_status
367: IGS_OR_UNIT,
368: IGS_OR_STATUS
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
371: AND IGS_OR_UNIT_REL.logical_delete_dt IS NULL
372: AND IGS_OR_UNIT.org_unit_cd = IGS_OR_UNIT_REL.child_org_unit_cd
373: AND IGS_OR_UNIT.start_dt = IGS_OR_UNIT_REL.child_start_dt
374: AND IGS_OR_STATUS.org_status = IGS_OR_UNIT.org_status
375: AND IGS_OR_STATUS.s_org_status = 'ACTIVE';
368: IGS_OR_STATUS
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
371: AND IGS_OR_UNIT_REL.logical_delete_dt IS NULL
372: AND IGS_OR_UNIT.org_unit_cd = IGS_OR_UNIT_REL.child_org_unit_cd
373: AND IGS_OR_UNIT.start_dt = IGS_OR_UNIT_REL.child_start_dt
374: AND IGS_OR_STATUS.org_status = IGS_OR_UNIT.org_status
375: AND IGS_OR_STATUS.s_org_status = 'ACTIVE';
376:
369: WHERE IGS_OR_UNIT_REL.parent_org_unit_cd = p_org_unit_cd
370: AND IGS_OR_UNIT_REL.parent_start_dt = p_start_dt
371: AND IGS_OR_UNIT_REL.logical_delete_dt IS NULL
372: AND IGS_OR_UNIT.org_unit_cd = IGS_OR_UNIT_REL.child_org_unit_cd
373: AND IGS_OR_UNIT.start_dt = IGS_OR_UNIT_REL.child_start_dt
374: AND IGS_OR_STATUS.org_status = IGS_OR_UNIT.org_status
375: AND IGS_OR_STATUS.s_org_status = 'ACTIVE';
376:
377: -- Fetch other active parents.
375: AND IGS_OR_STATUS.s_org_status = 'ACTIVE';
376:
377: -- Fetch other active parents.
378: CURSOR c_our_ou_os_parent (
379: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
380: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
381: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
382: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
383: SELECT parent_org_unit_cd,
376:
377: -- Fetch other active parents.
378: CURSOR c_our_ou_os_parent (
379: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
380: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
381: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
382: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
383: SELECT parent_org_unit_cd,
384: parent_start_dt
377: -- Fetch other active parents.
378: CURSOR c_our_ou_os_parent (
379: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
380: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
381: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
382: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
383: SELECT parent_org_unit_cd,
384: parent_start_dt
385: FROM IGS_OR_UNIT_REL,
378: CURSOR c_our_ou_os_parent (
379: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
380: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
381: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
382: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
383: SELECT parent_org_unit_cd,
384: parent_start_dt
385: FROM IGS_OR_UNIT_REL,
386: IGS_OR_UNIT,
381: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
382: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
383: SELECT parent_org_unit_cd,
384: parent_start_dt
385: FROM IGS_OR_UNIT_REL,
386: IGS_OR_UNIT,
387: IGS_OR_STATUS
388: WHERE child_org_unit_cd = cp_child_org_unit_cd
389: AND child_start_dt = cp_child_start_dt
595: -- Fetch active children.
596: CURSOR c_our_ou_os_child IS
597: SELECT child_org_unit_cd,
598: child_start_dt
599: FROM IGS_OR_UNIT_REL,
600: IGS_OR_UNIT,
601: IGS_OR_STATUS
602: WHERE parent_org_unit_cd = p_org_unit_cd
603: AND parent_start_dt = p_start_dt
608: AND IGS_OR_STATUS.s_org_status = 'ACTIVE';
609:
610: -- Fetch other active parents.
611: CURSOR c_our_ou_os_parent (
612: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
613: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
614: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
615: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
616: SELECT parent_org_unit_cd,
609:
610: -- Fetch other active parents.
611: CURSOR c_our_ou_os_parent (
612: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
613: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
614: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
615: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
616: SELECT parent_org_unit_cd,
617: parent_start_dt
610: -- Fetch other active parents.
611: CURSOR c_our_ou_os_parent (
612: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
613: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
614: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
615: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
616: SELECT parent_org_unit_cd,
617: parent_start_dt
618: FROM IGS_OR_UNIT_REL,
611: CURSOR c_our_ou_os_parent (
612: cp_parent_org_unit_cd IGS_OR_UNIT_REL.parent_org_unit_cd%TYPE,
613: cp_parent_start_dt IGS_OR_UNIT_REL.parent_start_dt%TYPE,
614: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
615: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
616: SELECT parent_org_unit_cd,
617: parent_start_dt
618: FROM IGS_OR_UNIT_REL,
619: IGS_OR_UNIT,
614: cp_child_org_unit_cd IGS_OR_UNIT_REL.child_org_unit_cd%TYPE,
615: cp_child_start_dt IGS_OR_UNIT_REL.child_start_dt%TYPE) IS
616: SELECT parent_org_unit_cd,
617: parent_start_dt
618: FROM IGS_OR_UNIT_REL,
619: IGS_OR_UNIT,
620: IGS_OR_STATUS
621: WHERE child_org_unit_cd = cp_child_org_unit_cd
622: AND child_start_dt = cp_child_start_dt