83:
84: i_empty_tbl ec_utils.mapping_tbl;
85:
86: BEGIN
87: if ec_debug.G_debug_level >= 2 then
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
84: i_empty_tbl ec_utils.mapping_tbl;
85:
86: BEGIN
87: if ec_debug.G_debug_level >= 2 then
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
85:
86: BEGIN
87: if ec_debug.G_debug_level >= 2 then
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
93: ec_debug.pl(3,'i_run_id',i_run_id);
86: BEGIN
87: if ec_debug.G_debug_level >= 2 then
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
93: ec_debug.pl(3,'i_run_id',i_run_id);
94: end if;
87: if ec_debug.G_debug_level >= 2 then
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
93: ec_debug.pl(3,'i_run_id',i_run_id);
94: end if;
95:
88: ec_debug.push('EC_OUTBOUND_STAGE.GET_DATA');
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
93: ec_debug.pl(3,'i_run_id',i_run_id);
94: end if;
95:
96: -- Initialize PL/SQL tables.
89: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
90: ec_debug.pl(3,'i_file_name',i_file_name);
91: ec_debug.pl(3,'i_file_path',i_file_path);
92: ec_debug.pl(3,'i_map_id',i_map_id);
93: ec_debug.pl(3,'i_run_id',i_run_id);
94: end if;
95:
96: -- Initialize PL/SQL tables.
97: i_level_info.DELETE;
109: i_level_info(i_level).start_record_number := TO_NUMBER(transaction_level.start_element);
110: i_level_info(i_level).Key_Column_Name := transaction_level.key_column_name;
111: i_level_info(i_level).Key_Column_Staging := transaction_level.primary_address_type;
112: i_level_info(i_level).primary_address_type := transaction_level.primary_address_type;
113: if ec_debug.G_debug_level = 3 then
114: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
115: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
116: end if;
117:
110: i_level_info(i_level).Key_Column_Name := transaction_level.key_column_name;
111: i_level_info(i_level).Key_Column_Staging := transaction_level.primary_address_type;
112: i_level_info(i_level).primary_address_type := transaction_level.primary_address_type;
113: if ec_debug.G_debug_level = 3 then
114: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
115: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
116: end if;
117:
118: /**
111: i_level_info(i_level).Key_Column_Staging := transaction_level.primary_address_type;
112: i_level_info(i_level).primary_address_type := transaction_level.primary_address_type;
113: if ec_debug.G_debug_level = 3 then
114: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
115: ec_debug.pl(3,'Key Column Name',i_level_info(i_level).Key_Column_Name);
116: end if;
117:
118: /**
119: Set the Initial Values for each Level
126: i_level_info(i_level).Key_Column_Position := NULL;
127: i_level_info(i_level).Key_Column_Staging := NULL;
128: i_level_info(i_level).tp_code_staging := NULL;
129:
130: if ec_debug.G_debug_level = 3 then
131: ec_debug.pl(3,'EC','ECE_STAGE_START_RECORD_NUMBER','LEVEL',i_level,'START_RECORD_NUMBER',
132: i_level_info(i_level).start_record_number);
133: end if;
134: /**
127: i_level_info(i_level).Key_Column_Staging := NULL;
128: i_level_info(i_level).tp_code_staging := NULL;
129:
130: if ec_debug.G_debug_level = 3 then
131: ec_debug.pl(3,'EC','ECE_STAGE_START_RECORD_NUMBER','LEVEL',i_level,'START_RECORD_NUMBER',
132: i_level_info(i_level).start_record_number);
133: end if;
134: /**
135: Load the Mapping Information between Flat File and Staging Fields
153: Check for Seed Data. If not Found then , then do not process.
154: **/
155: if i_level = 0
156: then
157: ec_debug.pl(0,'EC','ECE_SEED_DATA_MISSING','TRANSACTION_TYPE',i_transaction_type);
158: /**
159: Set the Retcode for the Concurrent Manager
160: **/
161: ec_utils.i_ret_code := 2;
233: i_run_id,
234: NULL
235: );
236:
237: ec_debug.pl(0,'EC','ECE_NO_LINES_READ','NO_OF_LINES',counter);
238: <
239: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',i_document_number);
240: if ec_debug.G_debug_level >= 2 then
241: ec_debug.pop('EC_OUTBOUND_STAGE.GET_DATA');
235: );
236:
237: ec_debug.pl(0,'EC','ECE_NO_LINES_READ','NO_OF_LINES',counter);
238: <
239: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',i_document_number);
240: if ec_debug.G_debug_level >= 2 then
241: ec_debug.pop('EC_OUTBOUND_STAGE.GET_DATA');
242: end if;
243: EXCEPTION
236:
237: ec_debug.pl(0,'EC','ECE_NO_LINES_READ','NO_OF_LINES',counter);
238: <
239: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',i_document_number);
240: if ec_debug.G_debug_level >= 2 then
241: ec_debug.pop('EC_OUTBOUND_STAGE.GET_DATA');
242: end if;
243: EXCEPTION
244: WHEN UTL_FILE.write_error THEN
237: ec_debug.pl(0,'EC','ECE_NO_LINES_READ','NO_OF_LINES',counter);
238: <
239: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',i_document_number);
240: if ec_debug.G_debug_level >= 2 then
241: ec_debug.pop('EC_OUTBOUND_STAGE.GET_DATA');
242: end if;
243: EXCEPTION
244: WHEN UTL_FILE.write_error THEN
245: ec_utils.i_ret_code :=2;
242: end if;
243: EXCEPTION
244: WHEN UTL_FILE.write_error THEN
245: ec_utils.i_ret_code :=2;
246: ec_debug.pl(0,'EC','ECE_UTL_WRITE_ERROR',null);
247: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
248: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
249: utl_file.fclose(u_file_handle);
250: raise EC_UTILS.PROGRAM_EXIT;
243: EXCEPTION
244: WHEN UTL_FILE.write_error THEN
245: ec_utils.i_ret_code :=2;
246: ec_debug.pl(0,'EC','ECE_UTL_WRITE_ERROR',null);
247: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
248: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
249: utl_file.fclose(u_file_handle);
250: raise EC_UTILS.PROGRAM_EXIT;
251: WHEN UTL_FILE.read_error THEN
244: WHEN UTL_FILE.write_error THEN
245: ec_utils.i_ret_code :=2;
246: ec_debug.pl(0,'EC','ECE_UTL_WRITE_ERROR',null);
247: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
248: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
249: utl_file.fclose(u_file_handle);
250: raise EC_UTILS.PROGRAM_EXIT;
251: WHEN UTL_FILE.read_error THEN
252: ec_utils.i_ret_code :=2;
249: utl_file.fclose(u_file_handle);
250: raise EC_UTILS.PROGRAM_EXIT;
251: WHEN UTL_FILE.read_error THEN
252: ec_utils.i_ret_code :=2;
253: ec_debug.pl(0,'EC','ECE_UTL_READ_ERROR',null);
254: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
255: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
256: utl_file.fclose(u_file_handle);
257: raise EC_UTILS.PROGRAM_EXIT;
250: raise EC_UTILS.PROGRAM_EXIT;
251: WHEN UTL_FILE.read_error THEN
252: ec_utils.i_ret_code :=2;
253: ec_debug.pl(0,'EC','ECE_UTL_READ_ERROR',null);
254: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
255: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
256: utl_file.fclose(u_file_handle);
257: raise EC_UTILS.PROGRAM_EXIT;
258: WHEN UTL_FILE.invalid_path THEN
251: WHEN UTL_FILE.read_error THEN
252: ec_utils.i_ret_code :=2;
253: ec_debug.pl(0,'EC','ECE_UTL_READ_ERROR',null);
254: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
255: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
256: utl_file.fclose(u_file_handle);
257: raise EC_UTILS.PROGRAM_EXIT;
258: WHEN UTL_FILE.invalid_path THEN
259: ec_utils.i_ret_code :=2;
256: utl_file.fclose(u_file_handle);
257: raise EC_UTILS.PROGRAM_EXIT;
258: WHEN UTL_FILE.invalid_path THEN
259: ec_utils.i_ret_code :=2;
260: ec_debug.pl(0,'EC','ECE_UTL_INVALID_PATH',null);
261: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
262: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
263: utl_file.fclose(u_file_handle);
264: raise EC_UTILS.PROGRAM_EXIT;
257: raise EC_UTILS.PROGRAM_EXIT;
258: WHEN UTL_FILE.invalid_path THEN
259: ec_utils.i_ret_code :=2;
260: ec_debug.pl(0,'EC','ECE_UTL_INVALID_PATH',null);
261: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
262: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
263: utl_file.fclose(u_file_handle);
264: raise EC_UTILS.PROGRAM_EXIT;
265: WHEN UTL_FILE.invalid_mode THEN
258: WHEN UTL_FILE.invalid_path THEN
259: ec_utils.i_ret_code :=2;
260: ec_debug.pl(0,'EC','ECE_UTL_INVALID_PATH',null);
261: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
262: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
263: utl_file.fclose(u_file_handle);
264: raise EC_UTILS.PROGRAM_EXIT;
265: WHEN UTL_FILE.invalid_mode THEN
266: ec_utils.i_ret_code :=2;
263: utl_file.fclose(u_file_handle);
264: raise EC_UTILS.PROGRAM_EXIT;
265: WHEN UTL_FILE.invalid_mode THEN
266: ec_utils.i_ret_code :=2;
267: ec_debug.pl(0,'EC','ECE_UTL_INVALID_MODE',null);
268: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
269: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
270: utl_file.fclose(u_file_handle);
271: raise EC_UTILS.PROGRAM_EXIT;
264: raise EC_UTILS.PROGRAM_EXIT;
265: WHEN UTL_FILE.invalid_mode THEN
266: ec_utils.i_ret_code :=2;
267: ec_debug.pl(0,'EC','ECE_UTL_INVALID_MODE',null);
268: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
269: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
270: utl_file.fclose(u_file_handle);
271: raise EC_UTILS.PROGRAM_EXIT;
272: WHEN UTL_FILE.invalid_operation THEN
265: WHEN UTL_FILE.invalid_mode THEN
266: ec_utils.i_ret_code :=2;
267: ec_debug.pl(0,'EC','ECE_UTL_INVALID_MODE',null);
268: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
269: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
270: utl_file.fclose(u_file_handle);
271: raise EC_UTILS.PROGRAM_EXIT;
272: WHEN UTL_FILE.invalid_operation THEN
273: ec_utils.i_ret_code :=2;
270: utl_file.fclose(u_file_handle);
271: raise EC_UTILS.PROGRAM_EXIT;
272: WHEN UTL_FILE.invalid_operation THEN
273: ec_utils.i_ret_code :=2;
274: ec_debug.pl(0,'EC','ECE_UTL_INVALID_OPERATION',null);
275: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
276: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
277: utl_file.fclose(u_file_handle);
278: raise EC_UTILS.PROGRAM_EXIT;
271: raise EC_UTILS.PROGRAM_EXIT;
272: WHEN UTL_FILE.invalid_operation THEN
273: ec_utils.i_ret_code :=2;
274: ec_debug.pl(0,'EC','ECE_UTL_INVALID_OPERATION',null);
275: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
276: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
277: utl_file.fclose(u_file_handle);
278: raise EC_UTILS.PROGRAM_EXIT;
279: WHEN UTL_FILE.invalid_filehandle THEN
272: WHEN UTL_FILE.invalid_operation THEN
273: ec_utils.i_ret_code :=2;
274: ec_debug.pl(0,'EC','ECE_UTL_INVALID_OPERATION',null);
275: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
276: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
277: utl_file.fclose(u_file_handle);
278: raise EC_UTILS.PROGRAM_EXIT;
279: WHEN UTL_FILE.invalid_filehandle THEN
280: ec_utils.i_ret_code :=2;
277: utl_file.fclose(u_file_handle);
278: raise EC_UTILS.PROGRAM_EXIT;
279: WHEN UTL_FILE.invalid_filehandle THEN
280: ec_utils.i_ret_code :=2;
281: ec_debug.pl(0,'EC','ECE_UTL_INVALID_FILEHANDLE',null);
282: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
283: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
284: utl_file.fclose(u_file_handle);
285: raise EC_UTILS.PROGRAM_EXIT;
278: raise EC_UTILS.PROGRAM_EXIT;
279: WHEN UTL_FILE.invalid_filehandle THEN
280: ec_utils.i_ret_code :=2;
281: ec_debug.pl(0,'EC','ECE_UTL_INVALID_FILEHANDLE',null);
282: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
283: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
284: utl_file.fclose(u_file_handle);
285: raise EC_UTILS.PROGRAM_EXIT;
286: WHEN UTL_FILE.internal_error THEN
279: WHEN UTL_FILE.invalid_filehandle THEN
280: ec_utils.i_ret_code :=2;
281: ec_debug.pl(0,'EC','ECE_UTL_INVALID_FILEHANDLE',null);
282: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
283: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
284: utl_file.fclose(u_file_handle);
285: raise EC_UTILS.PROGRAM_EXIT;
286: WHEN UTL_FILE.internal_error THEN
287: ec_utils.i_ret_code :=2;
284: utl_file.fclose(u_file_handle);
285: raise EC_UTILS.PROGRAM_EXIT;
286: WHEN UTL_FILE.internal_error THEN
287: ec_utils.i_ret_code :=2;
288: ec_debug.pl(0,'EC','ECE_UTL_INTERNAL_ERROR',null);
289: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
290: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
291: utl_file.fclose(u_file_handle);
292: raise EC_UTILS.PROGRAM_EXIT;
285: raise EC_UTILS.PROGRAM_EXIT;
286: WHEN UTL_FILE.internal_error THEN
287: ec_utils.i_ret_code :=2;
288: ec_debug.pl(0,'EC','ECE_UTL_INTERNAL_ERROR',null);
289: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
290: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
291: utl_file.fclose(u_file_handle);
292: raise EC_UTILS.PROGRAM_EXIT;
293: WHEN EC_UTILS.PROGRAM_EXIT THEN
286: WHEN UTL_FILE.internal_error THEN
287: ec_utils.i_ret_code :=2;
288: ec_debug.pl(0,'EC','ECE_UTL_INTERNAL_ERROR',null);
289: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
290: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
291: utl_file.fclose(u_file_handle);
292: raise EC_UTILS.PROGRAM_EXIT;
293: WHEN EC_UTILS.PROGRAM_EXIT THEN
294: raise;
293: WHEN EC_UTILS.PROGRAM_EXIT THEN
294: raise;
295: WHEN OTHERS THEN
296: ec_utils.i_ret_code :=2;
297: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
298: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
299: utl_file.fclose(u_file_handle);
300: raise EC_UTILS.PROGRAM_EXIT;
301: END Get_Data;
294: raise;
295: WHEN OTHERS THEN
296: ec_utils.i_ret_code :=2;
297: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_DATA');
298: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
299: utl_file.fclose(u_file_handle);
300: raise EC_UTILS.PROGRAM_EXIT;
301: END Get_Data;
302:
336: v_stage_id number;
337: v_transaction_level ece_stage.transaction_level%TYPE;
338: i_new_stage_cursor number := 0;
339: BEGIN
340: if ec_debug.G_debug_level >= 2 then
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
337: v_transaction_level ece_stage.transaction_level%TYPE;
338: i_new_stage_cursor number := 0;
339: BEGIN
340: if ec_debug.G_debug_level >= 2 then
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
345: ec_debug.pl(3,'i_stage_cursor',i_stage_cursor);
338: i_new_stage_cursor number := 0;
339: BEGIN
340: if ec_debug.G_debug_level >= 2 then
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
345: ec_debug.pl(3,'i_stage_cursor',i_stage_cursor);
346: end if;
339: BEGIN
340: if ec_debug.G_debug_level >= 2 then
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
345: ec_debug.pl(3,'i_stage_cursor',i_stage_cursor);
346: end if;
347: /* Implemented bulk collect for performance improvement. bug 3133379 */
340: if ec_debug.G_debug_level >= 2 then
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
345: ec_debug.pl(3,'i_stage_cursor',i_stage_cursor);
346: end if;
347: /* Implemented bulk collect for performance improvement. bug 3133379 */
348: OPEN cur_stage(i_transaction_type,i_run_id);
341: ec_debug.push('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
342: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
343: ec_debug.pl(3,'i_run_id',i_run_id);
344: ec_debug.pl(3,'i_parent_stage_id',i_parent_stage_id);
345: ec_debug.pl(3,'i_stage_cursor',i_stage_cursor);
346: end if;
347: /* Implemented bulk collect for performance improvement. bug 3133379 */
348: OPEN cur_stage(i_transaction_type,i_run_id);
349: loop
365: B_STAGE_ID(i),
366: i_select_cursor,
367: i_common_key
368: );
369: if ec_debug.G_debug_level = 3 then
370: ec_debug.pl(3,'b_stage_id',b_stage_id(i));
371: ec_debug.pl(3,'b_transaction_level',b_transaction_level(i));
372: end if;
373:
366: i_select_cursor,
367: i_common_key
368: );
369: if ec_debug.G_debug_level = 3 then
370: ec_debug.pl(3,'b_stage_id',b_stage_id(i));
371: ec_debug.pl(3,'b_transaction_level',b_transaction_level(i));
372: end if;
373:
374: END LOOP;
367: i_common_key
368: );
369: if ec_debug.G_debug_level = 3 then
370: ec_debug.pl(3,'b_stage_id',b_stage_id(i));
371: ec_debug.pl(3,'b_transaction_level',b_transaction_level(i));
372: end if;
373:
374: END LOOP;
375: b_stage_id.delete;
388: -- dbms_sql.parse(i_stage_cursor,cSelect_stmt,dbms_sql.native);
389: -- EXCEPTION
390: -- WHEN OTHERS THEN
391: -- error_position := dbms_sql.last_error_position;
392: -- ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
393: -- ece_error_handling_pvt.print_parse_error (error_position,cSelect_stmt);
394: -- EC_UTILS.i_ret_code :=2;
395: -- raise EC_UTILS.PROGRAM_EXIT;
396: -- END;
413: Execute the cursor; debug on the number of rows returned
414: **/
415: /** BEGIN
416: dummy := dbms_sql.execute(i_stage_cursor);
417: if ec_debug.G_debug_level = 3 then
418: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
419: ec_debug.pl(3,'i_stage_cursor', i_stage_cursor);
420: ec_debug.pl(3,cSelect_stmt);
421: end if;
414: **/
415: /** BEGIN
416: dummy := dbms_sql.execute(i_stage_cursor);
417: if ec_debug.G_debug_level = 3 then
418: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
419: ec_debug.pl(3,'i_stage_cursor', i_stage_cursor);
420: ec_debug.pl(3,cSelect_stmt);
421: end if;
422:
415: /** BEGIN
416: dummy := dbms_sql.execute(i_stage_cursor);
417: if ec_debug.G_debug_level = 3 then
418: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
419: ec_debug.pl(3,'i_stage_cursor', i_stage_cursor);
420: ec_debug.pl(3,cSelect_stmt);
421: end if;
422:
423: EXCEPTION
416: dummy := dbms_sql.execute(i_stage_cursor);
417: if ec_debug.G_debug_level = 3 then
418: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
419: ec_debug.pl(3,'i_stage_cursor', i_stage_cursor);
420: ec_debug.pl(3,cSelect_stmt);
421: end if;
422:
423: EXCEPTION
424: WHEN OTHERS THEN
421: end if;
422:
423: EXCEPTION
424: WHEN OTHERS THEN
425: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
426: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
427: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
428: ec_debug.pl(0,cSelect_stmt);
429: EC_UTILS.i_ret_code :=2;
422:
423: EXCEPTION
424: WHEN OTHERS THEN
425: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
426: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
427: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
428: ec_debug.pl(0,cSelect_stmt);
429: EC_UTILS.i_ret_code :=2;
430: raise EC_UTILS.PROGRAM_EXIT;
423: EXCEPTION
424: WHEN OTHERS THEN
425: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
426: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
427: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
428: ec_debug.pl(0,cSelect_stmt);
429: EC_UTILS.i_ret_code :=2;
430: raise EC_UTILS.PROGRAM_EXIT;
431: END; **/
424: WHEN OTHERS THEN
425: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
426: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
427: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
428: ec_debug.pl(0,cSelect_stmt);
429: EC_UTILS.i_ret_code :=2;
430: raise EC_UTILS.PROGRAM_EXIT;
431: END; **/
432:
435: LOOP
436: dbms_sql.column_value(i_stage_cursor,1,v_stage_id);
437: dbms_sql.column_value(i_stage_cursor,2,v_parent_stage_id);
438: dbms_sql.column_value(i_stage_cursor,3,v_transaction_level);
439: if ec_debug.G_debug_level = 3 then
440: ec_debug.pl(3,'v_stage_id',v_stage_id);
441: ec_debug.pl(3,'v_parent_stage_id',v_parent_stage_id);
442: ec_debug.pl(3,'v_transaction_level',v_transaction_level);
443: end if;
436: dbms_sql.column_value(i_stage_cursor,1,v_stage_id);
437: dbms_sql.column_value(i_stage_cursor,2,v_parent_stage_id);
438: dbms_sql.column_value(i_stage_cursor,3,v_transaction_level);
439: if ec_debug.G_debug_level = 3 then
440: ec_debug.pl(3,'v_stage_id',v_stage_id);
441: ec_debug.pl(3,'v_parent_stage_id',v_parent_stage_id);
442: ec_debug.pl(3,'v_transaction_level',v_transaction_level);
443: end if;
444:
437: dbms_sql.column_value(i_stage_cursor,2,v_parent_stage_id);
438: dbms_sql.column_value(i_stage_cursor,3,v_transaction_level);
439: if ec_debug.G_debug_level = 3 then
440: ec_debug.pl(3,'v_stage_id',v_stage_id);
441: ec_debug.pl(3,'v_parent_stage_id',v_parent_stage_id);
442: ec_debug.pl(3,'v_transaction_level',v_transaction_level);
443: end if;
444:
445:
438: dbms_sql.column_value(i_stage_cursor,3,v_transaction_level);
439: if ec_debug.G_debug_level = 3 then
440: ec_debug.pl(3,'v_stage_id',v_stage_id);
441: ec_debug.pl(3,'v_parent_stage_id',v_parent_stage_id);
442: ec_debug.pl(3,'v_transaction_level',v_transaction_level);
443: end if;
444:
445:
446: if ec_debug.G_debug_level = 3 then
442: ec_debug.pl(3,'v_transaction_level',v_transaction_level);
443: end if;
444:
445:
446: if ec_debug.G_debug_level = 3 then
447: ec_debug.pl(3,'i_level_info(v_transaction_level).select_cursor',i_level_info(v_transaction_level).select_cursor);
448: end if;
449:
450: Select_From_Stage_Table(
443: end if;
444:
445:
446: if ec_debug.G_debug_level = 3 then
447: ec_debug.pl(3,'i_level_info(v_transaction_level).select_cursor',i_level_info(v_transaction_level).select_cursor);
448: end if;
449:
450: Select_From_Stage_Table(
451: v_transaction_level,
462: i_common_key);
463: END LOOP;
464: EXCEPTION
465: WHEN OTHERS THEN
466: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
467: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
468: EC_UTILS.i_ret_code :=2;
469: raise EC_UTILS.PROGRAM_EXIT;
470: END;
463: END LOOP;
464: EXCEPTION
465: WHEN OTHERS THEN
466: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
467: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
468: EC_UTILS.i_ret_code :=2;
469: raise EC_UTILS.PROGRAM_EXIT;
470: END;
471: **/
472: /**
473: Close Cursor
474: **/
475: -- dbms_sql.close_cursor(i_stage_cursor);
476: if ec_debug.G_debug_level >= 2 then
477: ec_debug.pop('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
478: end if;
479:
480: EXCEPTION
473: Close Cursor
474: **/
475: -- dbms_sql.close_cursor(i_stage_cursor);
476: if ec_debug.G_debug_level >= 2 then
477: ec_debug.pop('EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
478: end if;
479:
480: EXCEPTION
481: WHEN EC_UTILS.PROGRAM_EXIT THEN
480: EXCEPTION
481: WHEN EC_UTILS.PROGRAM_EXIT THEN
482: raise;
483: WHEN OTHERS THEN
484: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
485: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
486: EC_UTILS.i_ret_code:=2;
487: raise EC_UTILS.PROGRAM_EXIT;
488: END Fetch_Stage_Data;
481: WHEN EC_UTILS.PROGRAM_EXIT THEN
482: raise;
483: WHEN OTHERS THEN
484: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.FETCH_STAGE_DATA');
485: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
486: EC_UTILS.i_ret_code:=2;
487: raise EC_UTILS.PROGRAM_EXIT;
488: END Fetch_Stage_Data;
489:
533: i_counter NUMBER :=i_stage_record_type.COUNT;
534: m_counter number := i_counter;
535: b_tp_found BOOLEAN := FALSE;
536: BEGIN
537: if ec_debug.G_debug_level >= 2 then
538: ec_debug.push('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
539: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
540: ec_debug.pl(3,'i_Level',i_level);
541: ec_debug.pl(3,'EC','ECE_INTERFACE_MAPPING','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
534: m_counter number := i_counter;
535: b_tp_found BOOLEAN := FALSE;
536: BEGIN
537: if ec_debug.G_debug_level >= 2 then
538: ec_debug.push('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
539: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
540: ec_debug.pl(3,'i_Level',i_level);
541: ec_debug.pl(3,'EC','ECE_INTERFACE_MAPPING','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
542: end if;
535: b_tp_found BOOLEAN := FALSE;
536: BEGIN
537: if ec_debug.G_debug_level >= 2 then
538: ec_debug.push('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
539: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
540: ec_debug.pl(3,'i_Level',i_level);
541: ec_debug.pl(3,'EC','ECE_INTERFACE_MAPPING','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
542: end if;
543:
536: BEGIN
537: if ec_debug.G_debug_level >= 2 then
538: ec_debug.push('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
539: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
540: ec_debug.pl(3,'i_Level',i_level);
541: ec_debug.pl(3,'EC','ECE_INTERFACE_MAPPING','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
542: end if;
543:
544: FOR transaction_mapping in c_file_mapping
537: if ec_debug.G_debug_level >= 2 then
538: ec_debug.push('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
539: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
540: ec_debug.pl(3,'i_Level',i_level);
541: ec_debug.pl(3,'EC','ECE_INTERFACE_MAPPING','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
542: end if;
543:
544: FOR transaction_mapping in c_file_mapping
545: (
557: i_stage_record_type(i_counter).record_layout_qualifier := transaction_mapping.record_layout_qualifier;
558: i_stage_record_type(i_counter).data_type := transaction_mapping.data_type;
559: i_stage_record_type(i_counter).position := transaction_mapping.position;
560: i_stage_record_type(i_counter).width := transaction_mapping.width;
561: if ec_debug.G_debug_level = 3 then
562: ec_debug.pl
563: (
564: 3,
565: i_counter||'|'||
558: i_stage_record_type(i_counter).data_type := transaction_mapping.data_type;
559: i_stage_record_type(i_counter).position := transaction_mapping.position;
560: i_stage_record_type(i_counter).width := transaction_mapping.width;
561: if ec_debug.G_debug_level = 3 then
562: ec_debug.pl
563: (
564: 3,
565: i_counter||'|'||
566: i_level||'|'||
578: i_level_info(i_level).key_column_name
579: THEN
580: i_level_info(i_level).key_column_position := i_counter;
581: i_level_info(i_level).key_column_staging := i_stage_record_type(i_counter).staging_column;
582: if ec_debug.G_debug_level = 3 then
583: ec_debug.pl
584: (3,
585: 'Key_Column',
586: i_level_info(i_level).Key_Column_position||'|'||
579: THEN
580: i_level_info(i_level).key_column_position := i_counter;
581: i_level_info(i_level).key_column_staging := i_stage_record_type(i_counter).staging_column;
582: if ec_debug.G_debug_level = 3 then
583: ec_debug.pl
584: (3,
585: 'Key_Column',
586: i_level_info(i_level).Key_Column_position||'|'||
587: i_level_info(i_level).Key_Column_position
597: -- := i_level_info(1).Key_column_name;
598: -- ece_flatfile_pvt.t_tran_attribute_tbl(1).position
599: -- := i_counter;
600: i_level_info(1).tp_code_staging := i_stage_record_type(i_counter).staging_column;
601: if ec_debug.G_debug_level = 3 then
602: ec_debug.pl
603: (3,
604: 'tp_code_staging',
605: i_stage_record_type(i_counter).staging_column
598: -- ece_flatfile_pvt.t_tran_attribute_tbl(1).position
599: -- := i_counter;
600: i_level_info(1).tp_code_staging := i_stage_record_type(i_counter).staging_column;
601: if ec_debug.G_debug_level = 3 then
602: ec_debug.pl
603: (3,
604: 'tp_code_staging',
605: i_stage_record_type(i_counter).staging_column
606: );
610:
611: END LOOP;
612:
613: if i_counter = m_counter then
614: ec_debug.pl(0,'EC','ECE_SEED_NOT_LEVEL','TRANSACTION_TYPE',i_transaction_type,'LEVEL',i_level);
615: /**
616: Set the Retcode for the Concurrent Manager to Error.
617: **/
618: ec_utils.i_ret_code := 2;
617: **/
618: ec_utils.i_ret_code := 2;
619: raise EC_UTILS.PROGRAM_EXIT;
620: end if;
621: if ec_debug.G_debug_level >= 2 then
622: ec_debug.pop('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
623: end if;
624: EXCEPTION
625: WHEN EC_UTILS.PROGRAM_EXIT then
618: ec_utils.i_ret_code := 2;
619: raise EC_UTILS.PROGRAM_EXIT;
620: end if;
621: if ec_debug.G_debug_level >= 2 then
622: ec_debug.pop('EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
623: end if;
624: EXCEPTION
625: WHEN EC_UTILS.PROGRAM_EXIT then
626: raise;
624: EXCEPTION
625: WHEN EC_UTILS.PROGRAM_EXIT then
626: raise;
627: WHEN OTHERS then
628: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
629: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
630: ec_utils.i_ret_code:=2;
631: raise ec_utils.program_exit;
632: END populate_flatfile_mapping;
625: WHEN EC_UTILS.PROGRAM_EXIT then
626: raise;
627: WHEN OTHERS then
628: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.POPULATE_FLATFILE_MAPPING');
629: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
630: ec_utils.i_ret_code:=2;
631: raise ec_utils.program_exit;
632: END populate_flatfile_mapping;
633:
650: i_rec_cd ece_interface_columns.record_layout_code%TYPE;
651: i_rec_ql ece_interface_columns.record_layout_qualifier%TYPE;
652: c_local_chr_39 VARCHAR2(1) := fnd_global.local_chr(39);
653: BEGIN
654: if ec_debug.G_debug_level >= 2 then
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
651: i_rec_ql ece_interface_columns.record_layout_qualifier%TYPE;
652: c_local_chr_39 VARCHAR2(1) := fnd_global.local_chr(39);
653: BEGIN
654: if ec_debug.G_debug_level >= 2 then
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
652: c_local_chr_39 VARCHAR2(1) := fnd_global.local_chr(39);
653: BEGIN
654: if ec_debug.G_debug_level >= 2 then
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
660: ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
653: BEGIN
654: if ec_debug.G_debug_level >= 2 then
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
660: ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
661: end if;
654: if ec_debug.G_debug_level >= 2 then
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
660: ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
661: end if;
662:
655: ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
660: ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
661: end if;
662:
663: /**
656: ec_debug.pl(3,'i_current_level',i_current_level);
657: ec_debug.pl(3,'record_number',i_record_num);
658: ec_debug.pl(3,'i_file_pos',i_file_pos);
659: ec_debug.pl(3,'counter',i_total_rec_unit);
660: ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
661: end if;
662:
663: /**
664: Build Application Data SELECT statement
666: FOR k IN i_next_file_pos..i_next_file_pos+i_total_rec_unit
667: LOOP
668: IF i_next_file_pos <= i_stage_record_type.count
669: THEN
670: -- ec_debug.pl(3,'k:interface_level',k||'|'||i_stage_record_type(k).interface_level);
671: -- ec_debug.pl(3,'k:external_level',k||'|'||i_record_info(i_file_pos).external_level);
672: IF i_stage_record_type(k).interface_level = i_record_info(i_file_pos).external_level AND
673: i_stage_record_type(k).record_number = i_record_info(i_file_pos).record_number
674: THEN
667: LOOP
668: IF i_next_file_pos <= i_stage_record_type.count
669: THEN
670: -- ec_debug.pl(3,'k:interface_level',k||'|'||i_stage_record_type(k).interface_level);
671: -- ec_debug.pl(3,'k:external_level',k||'|'||i_record_info(i_file_pos).external_level);
672: IF i_stage_record_type(k).interface_level = i_record_info(i_file_pos).external_level AND
673: i_stage_record_type(k).record_number = i_record_info(i_file_pos).record_number
674: THEN
675: -- ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
671: -- ec_debug.pl(3,'k:external_level',k||'|'||i_record_info(i_file_pos).external_level);
672: IF i_stage_record_type(k).interface_level = i_record_info(i_file_pos).external_level AND
673: i_stage_record_type(k).record_number = i_record_info(i_file_pos).record_number
674: THEN
675: -- ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
676: -- ec_debug.pl(3,'staging_column',i_stage_record_type(k).staging_column);
677: i_rec_cd := i_stage_record_type(k).record_layout_code;
678: i_rec_ql := i_stage_record_type(k).record_layout_qualifier;
679: i_record_info(i_file_pos).select_stmt := i_record_info(i_file_pos).select_stmt||
672: IF i_stage_record_type(k).interface_level = i_record_info(i_file_pos).external_level AND
673: i_stage_record_type(k).record_number = i_record_info(i_file_pos).record_number
674: THEN
675: -- ec_debug.pl(3,'i_next_file_pos',i_next_file_pos);
676: -- ec_debug.pl(3,'staging_column',i_stage_record_type(k).staging_column);
677: i_rec_cd := i_stage_record_type(k).record_layout_code;
678: i_rec_ql := i_stage_record_type(k).record_layout_qualifier;
679: i_record_info(i_file_pos).select_stmt := i_record_info(i_file_pos).select_stmt||
680: '||RPAD(NVL('||
708: c_local_chr_39||'||'||
709: c_local_chr_39||RPAD(NVL(i_rec_ql, g_rec_lql_fl),
710: g_rec_lql_ln, g_rec_lql_fl)||c_local_chr_39||
711: i_record_info(i_file_pos).select_stmt;
712: if ec_debug.G_debug_level >= 2 then
713: ec_debug.pl(3,i_file_pos||'|'||
714: i_record_info(i_file_pos).record_number||'|'||
715: i_record_info(i_file_pos).select_stmt);
716: ec_debug.pop('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
709: c_local_chr_39||RPAD(NVL(i_rec_ql, g_rec_lql_fl),
710: g_rec_lql_ln, g_rec_lql_fl)||c_local_chr_39||
711: i_record_info(i_file_pos).select_stmt;
712: if ec_debug.G_debug_level >= 2 then
713: ec_debug.pl(3,i_file_pos||'|'||
714: i_record_info(i_file_pos).record_number||'|'||
715: i_record_info(i_file_pos).select_stmt);
716: ec_debug.pop('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
717: end if;
712: if ec_debug.G_debug_level >= 2 then
713: ec_debug.pl(3,i_file_pos||'|'||
714: i_record_info(i_file_pos).record_number||'|'||
715: i_record_info(i_file_pos).select_stmt);
716: ec_debug.pop('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
717: end if;
718: EXCEPTION
719: WHEN OTHERS then
720: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_SELECT_STMT');
716: ec_debug.pop('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
717: end if;
718: EXCEPTION
719: WHEN OTHERS then
720: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_SELECT_STMT');
721: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
722: ec_utils.i_ret_code:=2;
723: raise EC_UTILS.PROGRAM_EXIT;
724: END get_select_stmt;
717: end if;
718: EXCEPTION
719: WHEN OTHERS then
720: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_SELECT_STMT');
721: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
722: ec_utils.i_ret_code:=2;
723: raise EC_UTILS.PROGRAM_EXIT;
724: END get_select_stmt;
725:
754: dummy INTEGER;
755: error_position integer;
756:
757: BEGIN
758: if ec_debug.G_debug_level >= 2 then
759: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
760: ec_debug.pl(3,'i_level',i_level);
761: ec_debug.pl(3,'i_stage_id',i_stage_id);
762: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
755: error_position integer;
756:
757: BEGIN
758: if ec_debug.G_debug_level >= 2 then
759: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
760: ec_debug.pl(3,'i_level',i_level);
761: ec_debug.pl(3,'i_stage_id',i_stage_id);
762: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
763: end if;
756:
757: BEGIN
758: if ec_debug.G_debug_level >= 2 then
759: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
760: ec_debug.pl(3,'i_level',i_level);
761: ec_debug.pl(3,'i_stage_id',i_stage_id);
762: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
763: end if;
764:
757: BEGIN
758: if ec_debug.G_debug_level >= 2 then
759: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
760: ec_debug.pl(3,'i_level',i_level);
761: ec_debug.pl(3,'i_stage_id',i_stage_id);
762: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
763: end if;
764:
765: if i_select_cursor = 0
758: if ec_debug.G_debug_level >= 2 then
759: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
760: ec_debug.pl(3,'i_level',i_level);
761: ec_debug.pl(3,'i_stage_id',i_stage_id);
762: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
763: end if;
764:
765: if i_select_cursor = 0
766: then
776: ',';
777:
778: FOR k IN 1..i_record_info.count
779: LOOP
780: -- ec_debug.pl(3,'k:external_level',k||'|'||i_record_info(k).external_level);
781: IF i_record_info(k).external_level = i_level
782: THEN
783: /**
784: Get Select Statement from PLSQL table
791: END LOOP;
792:
793: cSelect_stmt := RTRIM(cSelect_stmt,',');
794: cSelect_stmt := cSelect_stmt||cFrom_stmt||cWhere_stmt;
795: if ec_debug.G_debug_level = 3 then
796: ec_debug.pl(3,'cSelect_stmt',cSelect_stmt);
797: end if;
798: /**
799: Open the cursor and parse the SQL Statement. Trap any parsing error and report
792:
793: cSelect_stmt := RTRIM(cSelect_stmt,',');
794: cSelect_stmt := cSelect_stmt||cFrom_stmt||cWhere_stmt;
795: if ec_debug.G_debug_level = 3 then
796: ec_debug.pl(3,'cSelect_stmt',cSelect_stmt);
797: end if;
798: /**
799: Open the cursor and parse the SQL Statement. Trap any parsing error and report
800: the Error Position in the SQL Statement. Store cursor handle in PL/SQL table for
807: i_level_info(i_level).total_records := i_select_count;
808: EXCEPTION
809: WHEN OTHERS THEN
810: error_position := dbms_sql.last_error_position;
811: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
812: ece_error_handling_pvt.print_parse_error (error_position,cSelect_stmt);
813: EC_UTILS.i_ret_code :=2;
814: raise EC_UTILS.PROGRAM_EXIT;
815: END;
812: ece_error_handling_pvt.print_parse_error (error_position,cSelect_stmt);
813: EC_UTILS.i_ret_code :=2;
814: raise EC_UTILS.PROGRAM_EXIT;
815: END;
816: if ec_debug.G_debug_level = 3 then
817: ec_debug.pl(3,'EC','ECE_STAGE_SELECT_LEVEL','LEVEL',i_level,null);
818: end if;
819: end if;
820:
813: EC_UTILS.i_ret_code :=2;
814: raise EC_UTILS.PROGRAM_EXIT;
815: END;
816: if ec_debug.G_debug_level = 3 then
817: ec_debug.pl(3,'EC','ECE_STAGE_SELECT_LEVEL','LEVEL',i_level,null);
818: end if;
819: end if;
820:
821: if i_select_cursor > 0
824: /**
825: Bind values for Primary Key
826: **/
827: dbms_sql.bind_variable(i_select_cursor,'a1',i_stage_id);
828: if ec_debug.G_debug_level = 3 then
829: ec_debug.pl(3,'STAGE_ID',i_stage_id);
830: end if;
831: /**
832: Define the columns for return string
825: Bind values for Primary Key
826: **/
827: dbms_sql.bind_variable(i_select_cursor,'a1',i_stage_id);
828: if ec_debug.G_debug_level = 3 then
829: ec_debug.pl(3,'STAGE_ID',i_stage_id);
830: end if;
831: /**
832: Define the columns for return string
833: **/
843: Execute the cursor; debug on the number of rows returned
844: **/
845: BEGIN
846: dummy := dbms_sql.execute(i_select_cursor);
847: if ec_debug.G_debug_level = 3 then
848: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
849: ec_debug.pl(3,'i_select_cursor', i_select_cursor);
850: end if;
851: EXCEPTION
844: **/
845: BEGIN
846: dummy := dbms_sql.execute(i_select_cursor);
847: if ec_debug.G_debug_level = 3 then
848: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
849: ec_debug.pl(3,'i_select_cursor', i_select_cursor);
850: end if;
851: EXCEPTION
852: WHEN OTHERS THEN
845: BEGIN
846: dummy := dbms_sql.execute(i_select_cursor);
847: if ec_debug.G_debug_level = 3 then
848: ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
849: ec_debug.pl(3,'i_select_cursor', i_select_cursor);
850: end if;
851: EXCEPTION
852: WHEN OTHERS THEN
853: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
849: ec_debug.pl(3,'i_select_cursor', i_select_cursor);
850: end if;
851: EXCEPTION
852: WHEN OTHERS THEN
853: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
854: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
855: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
856: ec_debug.pl(0,cSelect_stmt);
857: EC_UTILS.i_ret_code :=2;
850: end if;
851: EXCEPTION
852: WHEN OTHERS THEN
853: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
854: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
855: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
856: ec_debug.pl(0,cSelect_stmt);
857: EC_UTILS.i_ret_code :=2;
858: raise EC_UTILS.PROGRAM_EXIT;
851: EXCEPTION
852: WHEN OTHERS THEN
853: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
854: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
855: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
856: ec_debug.pl(0,cSelect_stmt);
857: EC_UTILS.i_ret_code :=2;
858: raise EC_UTILS.PROGRAM_EXIT;
859: END;
852: WHEN OTHERS THEN
853: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
854: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
855: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
856: ec_debug.pl(0,cSelect_stmt);
857: EC_UTILS.i_ret_code :=2;
858: raise EC_UTILS.PROGRAM_EXIT;
859: END;
860:
884: END LOOP;
885: END LOOP;
886: EXCEPTION
887: WHEN OTHERS THEN
888: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
889: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
890: EC_UTILS.i_ret_code :=2;
891: raise EC_UTILS.PROGRAM_EXIT;
892: END;
885: END LOOP;
886: EXCEPTION
887: WHEN OTHERS THEN
888: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
889: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
890: EC_UTILS.i_ret_code :=2;
891: raise EC_UTILS.PROGRAM_EXIT;
892: END;
893:
891: raise EC_UTILS.PROGRAM_EXIT;
892: END;
893:
894: end if;
895: if ec_debug.G_debug_level >= 2 then
896: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
897:
898: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
899: end if;
892: END;
893:
894: end if;
895: if ec_debug.G_debug_level >= 2 then
896: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
897:
898: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
899: end if;
900: EXCEPTION
894: end if;
895: if ec_debug.G_debug_level >= 2 then
896: ec_debug.pl(3,'i_select_cursor',i_select_cursor);
897:
898: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
899: end if;
900: EXCEPTION
901: WHEN EC_UTILS.PROGRAM_EXIT THEN
902: raise;
904: IF dbms_sql.IS_OPEN(i_select_cursor)
905: then
906: dbms_sql.close_cursor(i_select_cursor);
907: end if;
908: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
909: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
910: EC_UTILS.i_ret_code:=2;
911: raise EC_UTILS.PROGRAM_EXIT;
912: END Select_From_Stage_Table;
905: then
906: dbms_sql.close_cursor(i_select_cursor);
907: end if;
908: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
909: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
910: EC_UTILS.i_ret_code:=2;
911: raise EC_UTILS.PROGRAM_EXIT;
912: END Select_From_Stage_Table;
913:
928: )
929: is
930: i_common_key_ln INTEGER := 0;
931: BEGIN
932: if ec_debug.G_debug_level >= 2 then
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
929: is
930: i_common_key_ln INTEGER := 0;
931: BEGIN
932: if ec_debug.G_debug_level >= 2 then
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
937: ec_debug.pl(3,'i_common_key',i_common_key);
930: i_common_key_ln INTEGER := 0;
931: BEGIN
932: if ec_debug.G_debug_level >= 2 then
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
937: ec_debug.pl(3,'i_common_key',i_common_key);
938: end if;
931: BEGIN
932: if ec_debug.G_debug_level >= 2 then
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
937: ec_debug.pl(3,'i_common_key',i_common_key);
938: end if;
939: IF i_level = 1
932: if ec_debug.G_debug_level >= 2 then
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
937: ec_debug.pl(3,'i_common_key',i_common_key);
938: end if;
939: IF i_level = 1
940: THEN
933: ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
934: ec_debug.pl(3,'i_level',i_level);
935: ec_debug.pl(3,'i_tp_code',i_tp_code);
936: ec_debug.pl(3,'i_key_column',i_key_column);
937: ec_debug.pl(3,'i_common_key',i_common_key);
938: end if;
939: IF i_level = 1
940: THEN
941: i_common_key := NULL;
953:
954: i_common_key := i_common_key||RPAD(SUBSTRB(NVL(i_key_column,g_ref_ckey_fl),1,g_ref_ckey_ln),g_ref_ckey_ln,g_ref_ckey_fl);
955:
956: i_common_key := RPAD(SUBSTRB(NVL(i_common_key,g_rec_ckey_fl),1,g_rec_ckey_ln),g_rec_ckey_ln,g_rec_ckey_fl);
957: if ec_debug.G_debug_level >= 2 then
958: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
959: end if;
960: EXCEPTION
961: WHEN OTHERS then
954: i_common_key := i_common_key||RPAD(SUBSTRB(NVL(i_key_column,g_ref_ckey_fl),1,g_ref_ckey_ln),g_ref_ckey_ln,g_ref_ckey_fl);
955:
956: i_common_key := RPAD(SUBSTRB(NVL(i_common_key,g_rec_ckey_fl),1,g_rec_ckey_ln),g_rec_ckey_ln,g_rec_ckey_fl);
957: if ec_debug.G_debug_level >= 2 then
958: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
959: end if;
960: EXCEPTION
961: WHEN OTHERS then
962: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
958: ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
959: end if;
960: EXCEPTION
961: WHEN OTHERS then
962: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
963: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
964: ec_utils.i_ret_code:=2;
965: raise EC_UTILS.PROGRAM_EXIT;
966: END Select_Common_Key;
959: end if;
960: EXCEPTION
961: WHEN OTHERS then
962: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
963: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
964: ec_utils.i_ret_code:=2;
965: raise EC_UTILS.PROGRAM_EXIT;
966: END Select_Common_Key;
967: