82:
83: write_log(1, 'Begin gathering stats: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
84:
85: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_PEOPLE');
86: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_ASSIGNMENTS');
87: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_ORGANIZATIONS');
88: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_JOBS');
89: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_POSITIONS');
90: fnd_stats.gather_table_stats(g_schema_owner,'PER_EMPDIR_PHONES');
108:
109: FOR I IN 1 .. p_cnt LOOP
110: BEGIN
111: SELECT count(unique a.person_id)-1 INTO cntTbl.cnt(I)
112: FROM per_empdir_assignments a,
113: per_empdir_people p
114: WHERE a.orig_system = cntTbl.orig_system(I)
115: AND a.active = 'Y'
116: and a.PERSON_ID = p.orig_system_ID
160: write_log(1, 'Begin Compute Directs: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
161:
162: UPDATE per_empdir_people p
163: SET direct_reports = (SELECT count(*)
164: FROM per_empdir_assignments a, per_empdir_people rp
165: WHERE supervisor_id = p.orig_system_id
166: AND a.orig_system = p.orig_system
167: AND a.active = 'Y'
168: -- AND a.primary_flag = 'Y'
916:
917: g_date := trunc(SYSDATE);
918:
919: FORALL I IN 1 .. p_cnt
920: UPDATE per_empdir_assignments
921: SET orig_system = asgTbl.orig_system(I)
922: ,orig_system_id = asgTbl.orig_system_id(I)
923: ,business_group_id = asgTbl.business_group_id(I)
924: ,position_id = asgTbl.position_id(I)
997: BEGIN
998: g_date := trunc(SYSDATE);
999:
1000: FORALL I IN 1 .. p_cnt
1001: INSERT INTO per_empdir_assignments values (
1002: asgTbl.orig_system(I)
1003: ,asgTbl.orig_system_id(I)
1004: ,asgTbl.business_group_id(I)
1005: ,asgTbl.position_id(I)
1120: IF (p_mode = 0) THEN
1121: query_str := query_str || ' AND astatus.per_system_status <> ''TERM_ASSIGN''';
1122: OPEN p_cursor FOR query_str using p_eff_date,l_multi_asg,p_eff_date;
1123: ELSIF (p_mode = 1) THEN
1124: query_str := query_str || ' AND EXISTS (SELECT ''e'' from per_empdir_assignments ia '||
1125: ' WHERE ia.orig_system_id = paf.assignment_id'||
1126: ' AND ia.orig_system = ''' || g_srcSystem || ''''||
1127: ' AND (ia.object_version_number <> paf.object_version_number '||
1128: ' OR paf.effective_start_date >= ia.last_update_date ))';
1128: ' OR paf.effective_start_date >= ia.last_update_date ))';
1129: OPEN p_cursor FOR query_str using p_eff_date,l_multi_asg,p_eff_date;
1130: ELSIF (p_mode = 2) THEN
1131: query_str := query_str || ' AND astatus.per_system_status <> ''TERM_ASSIGN'''||
1132: ' AND NOT EXISTS (SELECT ''e'' from per_empdir_assignments ia'||
1133: ' WHERE ia.orig_system_id = paf.assignment_id'||
1134: ' AND ia.orig_system = ''' || g_srcSystem|| ''')';
1135: OPEN p_cursor FOR query_str using p_eff_date,l_multi_asg,p_eff_date;
1136: END IF;
3077: ,p_eff_date
3078: ,p_multi_asg
3079: );
3080:
3081: write_log(1, 'Total # of records updated for per_empdir_assignments: '||l_cnt);
3082: write_log(2, 'Total # of records updated for per_empdir_assignments: '||l_cnt);
3083:
3084: bulk_process_per_asg(
3085: 2
3078: ,p_multi_asg
3079: );
3080:
3081: write_log(1, 'Total # of records updated for per_empdir_assignments: '||l_cnt);
3082: write_log(2, 'Total # of records updated for per_empdir_assignments: '||l_cnt);
3083:
3084: bulk_process_per_asg(
3085: 2
3086: ,l_cnt
3089: ,p_eff_date
3090: ,p_multi_asg
3091: );
3092:
3093: write_log(1, 'Total # of new records processed for per_empdir_assignments: '||l_cnt);
3094: write_log(2, 'Total # of new records processed for per_empdir_assignments: '||l_cnt);
3095: write_log(1, 'End merge per assignments: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3096:
3097:
3090: ,p_multi_asg
3091: );
3092:
3093: write_log(1, 'Total # of new records processed for per_empdir_assignments: '||l_cnt);
3094: write_log(2, 'Total # of new records processed for per_empdir_assignments: '||l_cnt);
3095: write_log(1, 'End merge per assignments: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3096:
3097:
3098: EXCEPTION WHEN OTHERS THEN
3113:
3114: BEGIN
3115:
3116: write_log(1, 'Begin populating per assginments: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3117: EXECUTE IMMEDIATE 'ALTER TABLE '||g_schema_owner||'.PER_EMPDIR_ASSIGNMENTS TRUNCATE PARTITION internal REUSE STORAGE';
3118: EXECUTE IMMEDIATE 'ALTER INDEX '||g_schema_owner||'.PER_EMPDIR_ASSIGNMENTS_PK REBUILD';
3119:
3120: g_date := trunc(SYSDATE);
3121:
3114: BEGIN
3115:
3116: write_log(1, 'Begin populating per assginments: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3117: EXECUTE IMMEDIATE 'ALTER TABLE '||g_schema_owner||'.PER_EMPDIR_ASSIGNMENTS TRUNCATE PARTITION internal REUSE STORAGE';
3118: EXECUTE IMMEDIATE 'ALTER INDEX '||g_schema_owner||'.PER_EMPDIR_ASSIGNMENTS_PK REBUILD';
3119:
3120: g_date := trunc(SYSDATE);
3121:
3122: bulk_process_per_asg(
3127: ,p_eff_date
3128: ,p_multi_asg
3129: );
3130:
3131: write_log(1, 'Total # of records processed for per_empdir_assignments: '||l_cnt);
3132: write_log(2, 'Total # of records processed for per_empdir_assignments: '||l_cnt);
3133: write_log(1, 'End populating per asg: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3134:
3135: EXCEPTION WHEN OTHERS THEN
3128: ,p_multi_asg
3129: );
3130:
3131: write_log(1, 'Total # of records processed for per_empdir_assignments: '||l_cnt);
3132: write_log(2, 'Total # of records processed for per_empdir_assignments: '||l_cnt);
3133: write_log(1, 'End populating per asg: '||to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3134:
3135: EXCEPTION WHEN OTHERS THEN
3136: errbuf := errbuf||SQLERRM;
3671:
3672: write_log(1, 'Process began @: '|| to_char(SYSDATE, 'DD/MM/RRRR HH:MI:SS'));
3673:
3674: BEGIN
3675: EXECUTE IMMEDIATE 'ALTER TRIGGER PER_EMPDIR_ASSIGNMENTS_WHO DISABLE';
3676: EXECUTE IMMEDIATE 'ALTER TRIGGER PER_EMPDIR_LOCATIONS_WHO DISABLE';
3677: EXECUTE IMMEDIATE 'ALTER TRIGGER PER_EMPDIR_PEOPLE_WHO DISABLE';
3678: EXECUTE IMMEDIATE 'ALTER TRIGGER PER_EMPDIR_PHONES_WHO DISABLE';
3679: