52: -- progress until the push_to_local procedure for
53: -- all view types has completed successfully.
54: -- ------------------------------------------------
55:
56: edw_log.put_line(' ');
57: edw_log.put_line('Pushing data to local staging table...');
58:
59: l_temp_date := sysdate;
60: Insert Into POA_EDW_CSTM_MSR_FSTG (
53: -- all view types has completed successfully.
54: -- ------------------------------------------------
55:
56: edw_log.put_line(' ');
57: edw_log.put_line('Pushing data to local staging table...');
58:
59: l_temp_date := sysdate;
60: Insert Into POA_EDW_CSTM_MSR_FSTG (
61: DUNS_FK,
159:
160: l_rows_inserted := sql%rowcount;
161: l_duration := sysdate - l_temp_date;
162:
163: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
164: ' rows into the local staging table');
165: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
166: edw_log.put_line(' ');
167:
161: l_duration := sysdate - l_temp_date;
162:
163: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
164: ' rows into the local staging table');
165: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
166: edw_log.put_line(' ');
167:
168: RETURN (l_rows_inserted);
169:
162:
163: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
164: ' rows into the local staging table');
165: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
166: edw_log.put_line(' ');
167:
168: RETURN (l_rows_inserted);
169:
170: EXCEPTION
269: g_push_date_range1 := nvl(l_from_date,
270: EDW_COLLECTION_UTIL.G_local_last_push_start_date - EDW_COLLECTION_UTIL.g_offset);
271: g_push_date_range2 := nvl(l_to_date,EDW_COLLECTION_UTIL.G_local_curr_push_start_date);
272:
273: edw_log.put_line( 'The collection range is from '||
274: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
275: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
276: edw_log.put_line(' ');
277:
272:
273: edw_log.put_line( 'The collection range is from '||
274: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
275: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
276: edw_log.put_line(' ');
277:
278: l_temp_date := sysdate;
279:
280: -- --------------------------------------------
279:
280: -- --------------------------------------------
281: -- Identify Change
282: -- --------------------------------------------
283: edw_log.put_line(' ');
284: edw_log.put_line('Identifying changes...');
285: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
286:
287: if (l_seq_id = -1) THEN
280: -- --------------------------------------------
281: -- Identify Change
282: -- --------------------------------------------
283: edw_log.put_line(' ');
284: edw_log.put_line('Identifying changes...');
285: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
286:
287: if (l_seq_id = -1) THEN
288: RAISE l_iden_change_failure;
286:
287: if (l_seq_id = -1) THEN
288: RAISE l_iden_change_failure;
289: end if;
290: edw_log.put_line('Identified ' || l_row_count || ' changed records');
291:
292: -- --------------------------------------------
293: -- Push to local staging table for view type 1
294: -- --------------------------------------------
292: -- --------------------------------------------
293: -- Push to local staging table for view type 1
294: -- --------------------------------------------
295:
296: edw_log.put_line(' ');
297: edw_log.put_line('Inserting into local staging table for view type 1');
298: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
299:
300: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
293: -- Push to local staging table for view type 1
294: -- --------------------------------------------
295:
296: edw_log.put_line(' ');
297: edw_log.put_line('Inserting into local staging table for view type 1');
298: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
299:
300: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
301:
298: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
299:
300: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
301:
302: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
303: ' rows into the local staging table for view type 1');
304: edw_log.put_line(' ');
305:
306: -- --------------------------------------------
300: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
301:
302: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
303: ' rows into the local staging table for view type 1');
304: edw_log.put_line(' ');
305:
306: -- --------------------------------------------
307: -- Delete all incremental tables' record
308: -- --------------------------------------------
313: -- No exception raised so far. Call wrapup to transport
314: -- data to target database, and insert messages into logs
315: -- -----------------------------------------------
316: g_row_count := g_row_count + l_row_count1;
317: edw_log.put_line(' ');
318: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
319: ' rows into the staging table');
320: l_duration := sysdate - l_temp_date;
321: edw_log.put_line(' ');
314: -- data to target database, and insert messages into logs
315: -- -----------------------------------------------
316: g_row_count := g_row_count + l_row_count1;
317: edw_log.put_line(' ');
318: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
319: ' rows into the staging table');
320: l_duration := sysdate - l_temp_date;
321: edw_log.put_line(' ');
322: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
317: edw_log.put_line(' ');
318: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
319: ' rows into the staging table');
320: l_duration := sysdate - l_temp_date;
321: edw_log.put_line(' ');
322: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
323: edw_log.put_line(' ');
324:
325: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
318: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
319: ' rows into the staging table');
320: l_duration := sysdate - l_temp_date;
321: edw_log.put_line(' ');
322: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
323: edw_log.put_line(' ');
324:
325: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
326: P_PERIOD_START => g_push_date_range1,
319: ' rows into the staging table');
320: l_duration := sysdate - l_temp_date;
321: edw_log.put_line(' ');
322: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
323: edw_log.put_line(' ');
324:
325: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
326: P_PERIOD_START => g_push_date_range1,
327: P_PERIOD_END => g_push_date_range2);
332: Errbuf:=g_errbuf;
333: Retcode:=g_retcode;
334: l_exception_msg := Retcode || ':' || Errbuf;
335: rollback; -- Rollback insert into local staging
336: edw_log.put_line('Inserting into local staging have failed');
337: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
338: g_push_date_range1, g_push_date_range2);
339: raise;
340:
342: Errbuf:=g_errbuf;
343: Retcode:=g_retcode;
344: l_exception_msg := Retcode || ':' || Errbuf;
345: TRUNCATE_INC;
346: edw_log.put_line('Identifying changed records have Failed');
347: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
348: g_push_date_range1, g_push_date_range2);
349: raise;
350:
352: Errbuf:=g_errbuf;
353: Retcode:=g_retcode;
354: l_exception_msg := Retcode || ':' || Errbuf;
355: rollback;
356: edw_log.put_line('Other errors');
357: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
358: g_push_date_range1, g_push_date_range2);
359: raise;
360: