DBA Data[Home] [Help]

APPS.EC_OUTBOUND_STAGE SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 40

	select	eel.start_element,
		eit.interface_table_id,
		eit.key_column_name,
		eit.primary_address_type
	from	ece_interface_tables eit,
		ece_level_matrices elm,
		ece_external_levels eel
	where	eit.transaction_type = p_transaction_type
	and	eit.interface_table_id = elm.interface_table_id
	and	elm.external_level_id = eel.external_level_id
	and	eel.map_id = p_map_id
	order by to_number(external_level);
Line: 59

	select	DISTINCT(eic.record_number) record_number
	        , eel.external_level external_level
	        , eel.start_element start_element
	        , COUNT(*) counter
	from	ece_interface_tables eit,
	        ece_interface_columns eic,
		ece_level_matrices elm,
		ece_external_levels eel
	where	eit.transaction_type = p_transaction_type
	and     eic.interface_table_id = eit.interface_table_id
	and	eit.interface_table_id = elm.interface_table_id
	and	elm.external_level_id = eel.external_level_id
	and     eic.record_number IS NOT NULL
	and	eic.position IS NOT NULL
	and	eel.map_id = p_map_id
	group by eel.external_level, eic.record_number, eel.start_element
	order by eel.external_level, eic.record_number;
Line: 97

i_level_info.DELETE;
Line: 98

i_stage_record_type.DELETE;
Line: 120

	i_level_info(i_level).Select_Cursor := 0;
Line: 147

Make a copy of the PL/SQL table and save it. After Inserting the Data into the
staging table , initialize the PL/SQL table with values from saved PL/SQL table.
**/
i_empty_tbl := i_stage_record_type;
Line: 166

Build each record's SELECT statement
**/
l_next_file_pos :=1;
Line: 181

	get_select_stmt(record_level.external_level,
		        i_record_info(i_record).record_number,
		        i_record,
		        l_next_file_pos,
		        i_record_info(i_record).counter);
Line: 216

The Cursors for the Select From Stage table are not closed in the Select_From_Stage_table
procedure call. Since the Cursor handles are maintained in the I_LEVEL_INFO PL/SQL table,
Cursors for the all Levels are closed using these Cursor handles.
**/
FOR i in 1..i_level_info.COUNT
LOOP
	IF dbms_sql.IS_OPEN(i_level_info(i).Select_Cursor)
	THEN
		dbms_sql.Close_cursor(i_level_info(i).Select_Cursor);
Line: 229

Delete all records from the staging table
**/
ec_outbound.delete_stage_data
	(
	i_run_id,
	NULL
	);
Line: 323

  SELECT STAGE_ID,TRANSACTION_LEVEL
  FROM ECE_STAGE
  WHERE TRANSACTION_TYPE = p_transaction_type
  AND RUN_ID = p_run_id
  ORDER BY STAGE_ID;        -- bug 3133379
Line: 332

i_select_cursor		INTEGER := 0;
Line: 361

  i_select_cursor := NVL(i_level_info(b_transaction_level(i)).select_cursor,0);
Line: 363

    Select_From_Stage_Table(
					B_TRANSACTION_LEVEL(i),
					B_STAGE_ID(i),
					i_select_cursor,
					i_common_key
					);
Line: 375

  b_stage_id.delete;
Line: 376

  b_transaction_level.delete;
Line: 380

	--cSelect_stmt := cSelect_stmt||cFrom_stmt||cWhere_stmt;
Line: 388

	--	dbms_sql.parse(i_stage_cursor,cSelect_stmt,dbms_sql.native);
Line: 393

	--	ece_error_handling_pvt.print_parse_error (error_position,cSelect_stmt);
Line: 418

		ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
Line: 420

		ec_debug.pl(3,cSelect_stmt);
Line: 428

		ec_debug.pl(0,cSelect_stmt);
Line: 447

		ec_debug.pl(3,'i_level_info(v_transaction_level).select_cursor',i_level_info(v_transaction_level).select_cursor);
Line: 450

		Select_From_Stage_Table(
					v_transaction_level,
					v_stage_id,
					i_select_cursor,
					i_common_key
					);
Line: 511

	SELECT eic.interface_table_id,
		eic.interface_column_name,
		eic.staging_column,
		eic.record_number,
		eic.record_layout_code,
		eic.record_layout_qualifier,
		eic.data_type,
		eic.position,
		eic.width
	FROM ece_interface_tables eit,
		ece_level_matrices elm,
		ece_external_levels eel,
		ece_interface_columns eic
	WHERE eit.interface_table_id = eic.interface_table_id
	AND	eit.transaction_type = p_transaction_type
	AND	eic.external_level = p_level
	AND	eit.interface_table_id = elm.interface_table_id
	AND	elm.external_level_id = eel.external_level_id
	AND	eel.map_id = p_map_id
	and     eic.record_number IS NOT NULL
	and	eic.position IS NOT NULL
	ORDER BY eic.record_number, eic.position;
Line: 635

This procedure formats the main body of a SELECT statement for each record number of
a given transaction and saves the result in a local PL/SQL table for later parsing.
This procedure is called once for each record number regardless of the number of
columns in the staging table in order to save on the number of PL/SQL string operations
required
**/
PROCEDURE get_select_stmt
		(
		i_current_level		IN	NUMBER,
		i_record_num		IN	number,
		i_file_pos		IN	number,
		i_next_file_pos         IN OUT NOCOPY  number,
		i_total_rec_unit	IN	number
		)
IS
i_rec_cd	ece_interface_columns.record_layout_code%TYPE;
Line: 655

ec_debug.push('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
Line: 664

	Build Application Data SELECT statement
	**/
	FOR k IN i_next_file_pos..i_next_file_pos+i_total_rec_unit
	LOOP
	   IF i_next_file_pos <= i_stage_record_type.count
	   THEN
	      -- ec_debug.pl(3,'k:interface_level',k||'|'||i_stage_record_type(k).interface_level);
Line: 679

	         i_record_info(i_file_pos).select_stmt := i_record_info(i_file_pos).select_stmt||
	                               '||RPAD(NVL('||
	                               NVL(i_stage_record_type(k).staging_column,'NULL')||
	                               ','||
	                               c_local_chr_39 ||g_rec_appd_fl||c_local_chr_39||
	                               '),'||
	                               i_stage_record_type(k).width||
	                               ','||
	                               c_local_chr_39||g_rec_appd_fl||c_local_chr_39||
	                               ')';
Line: 702

	i_record_info(i_file_pos).select_stmt :=
	                   c_local_chr_39||
                           LPAD(NVL(TO_CHAR(i_record_info(i_file_pos).record_number),g_rec_num_fl),
                           g_rec_num_ln, g_rec_num_fl)||c_local_chr_39||'||'||
	                   c_local_chr_39||
                           RPAD(NVL(i_rec_cd, g_rec_lcd_fl),g_rec_lcd_ln, g_rec_lcd_fl)||
                           c_local_chr_39||'||'||
	                   c_local_chr_39||RPAD(NVL(i_rec_ql, g_rec_lql_fl),
                           g_rec_lql_ln, g_rec_lql_fl)||c_local_chr_39||
	                   i_record_info(i_file_pos).select_stmt;
Line: 715

	              i_record_info(i_file_pos).select_stmt);
Line: 716

        ec_debug.pop('EC_OUTBOUND_STAGE.GET_SELECT_STMT');
Line: 720

	ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.GET_SELECT_STMT');
Line: 724

END get_select_stmt;
Line: 734

procedure Select_From_Stage_Table
	(
	i_level		IN	NUMBER,
	i_stage_id	IN	NUMBER,
	i_select_cursor	IN OUT NOCOPY 	NUMBER,
	i_common_key	IN OUT NOCOPY	VARCHAR2
	)
is
cSelect_stmt		varchar2(32000) := 'SELECT ';
Line: 751

i_select_count 		INTEGER := 0;
Line: 759

ec_debug.push('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 762

ec_debug.pl(3,'i_select_cursor',i_select_cursor);
Line: 765

if i_select_cursor = 0
then
	i_select_cursor := -911;
Line: 770

if i_select_cursor < 0
then
	cSelect_stmt := cSelect_stmt||
			NVL(i_level_info(i_level).tp_code_staging,'NULL')||
			','||
			NVL(i_level_info(i_level).Key_Column_Staging,'NULL')||
			',';
Line: 784

		Get Select Statement from PLSQL table
		**/
		i_select_count := i_select_count + 1;
Line: 787

		cSelect_stmt := cSelect_stmt||
				i_record_info(k).select_stmt||
				',';
Line: 793

	cSelect_stmt := RTRIM(cSelect_stmt,',');
Line: 794

	cSelect_stmt := cSelect_stmt||cFrom_stmt||cWhere_stmt;
Line: 796

	ec_debug.pl(3,'cSelect_stmt',cSelect_stmt);
Line: 803

	i_select_cursor := dbms_sql.Open_Cursor;
Line: 805

		dbms_sql.parse(i_select_cursor,cSelect_stmt,dbms_sql.native);
Line: 806

		i_level_info(i_level).select_cursor := i_select_cursor;
Line: 807

		i_level_info(i_level).total_records := i_select_count;
Line: 811

		ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 812

		ece_error_handling_pvt.print_parse_error (error_position,cSelect_stmt);
Line: 817

	ec_debug.pl(3,'EC','ECE_STAGE_SELECT_LEVEL','LEVEL',i_level,null);
Line: 821

if i_select_cursor > 0
then

	/**
	Bind values for Primary Key
	**/
	dbms_sql.bind_variable(i_select_cursor,'a1',i_stage_id);
Line: 834

 	dbms_sql.define_column(i_select_cursor,1,v_dummy_tp_code,2000);
Line: 835

 	dbms_sql.define_column(i_select_cursor,2,v_dummy_key_staging,2000);
Line: 839

 		dbms_sql.define_column(i_select_cursor,n,v_dummy(n),2000);
Line: 846

		dummy := dbms_sql.execute(i_select_cursor);
Line: 848

		ec_debug.pl(3,'EC','ECE_STAGE_SELECTED',NULL);
Line: 849

		ec_debug.pl(3,'i_select_cursor', i_select_cursor);
Line: 853

		ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 856

		ec_debug.pl(0,cSelect_stmt);
Line: 862

	   WHILE dbms_sql.fetch_rows(i_select_cursor) > 0
	   LOOP

		/** You can comment out this call if you don't want the Common Key to be formatted on the flat file.
		This is provides a performance boost due to the slow PL/SQL string operations required for the common key
		**/
		dbms_sql.column_value(i_select_cursor,1,v_dummy_tp_code);
Line: 869

		dbms_sql.column_value(i_select_cursor,2,v_dummy_key_staging);
Line: 870

		Select_Common_key(
				 i_level,
				 v_dummy_tp_code,
				 v_dummy_key_staging,
			  	 i_common_key
			  	 );
Line: 882

 			dbms_sql.column_value(i_select_cursor,m,v_dummy(m));
Line: 888

		ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL', 'EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 896

	ec_debug.pl(3,'i_select_cursor',i_select_cursor);
Line: 898

	ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 904

	IF dbms_sql.IS_OPEN(i_select_cursor)
	then
		dbms_sql.close_cursor(i_select_cursor);
Line: 908

	ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_FROM_STAGE_TABLE');
Line: 912

END Select_From_Stage_Table;
Line: 922

procedure Select_Common_Key
	(
	i_level		IN	NUMBER,
	i_tp_code	IN	VARCHAR2,
	i_key_column	IN	VARCHAR2,
	i_common_key    IN OUT NOCOPY  VARCHAR2
	)
is
i_common_key_ln		INTEGER := 0;
Line: 933

ec_debug.push('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
Line: 943

		Build Common Key TP CODE SELECT
		**/
		i_common_key := RPAD(SUBSTRB(NVL(i_tp_code,g_tp_ckey_fl),1,g_tp_ckey_ln),g_tp_ckey_ln,g_tp_ckey_fl);
Line: 958

	ec_debug.pop('EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
Line: 962

	ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND_STAGE.SELECT_COMMON_KEY');
Line: 966

END Select_Common_Key;