DBA Data[Home] [Help]

APPS.EC_INBOUND_STAGE SQL Statements

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

Line: 37

	select	eel.start_element,
                eel.external_level,
		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: 53

	select	ece_stage_id_s.NEXTVAL
	from	dual;
Line: 58

	select	ece_document_id_s.NEXTVAL
	from	dual;
Line: 80

i_insert_cursor		number :=0;
Line: 102

			This table is updated after each record is read i.e.
			Document Id , Stage Id , Line Number,Parent Stage id etc.
			and is used while inserting a record in the Staging table for a level.

i_stage_record_type	Stores the Mapping information for the Flat File
			Level,Record Number,Position,Staging Column,Width etc.
**/

-- Initialize PL/SQL tables.
i_level_info.DELETE;
Line: 112

i_stage_record_type.DELETE;
Line: 113

ece_flatfile_pvt.t_tran_attribute_tbl.DELETE;
Line: 122

	select	ece_output_runs_s.NEXTVAL
	into	i_run_id
	from	dual;
Line: 156

	i_level_info(i_level).Insert_Cursor := 0;
Line: 188

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: 209

	select value
	into   ec_inbound_stage.g_source_charset
	from   v$nls_parameters
	where  parameter='NLS_CHARACTERSET';
Line: 219

	select value,decode(value,ec_inbound_stage.g_source_charset,'Y','N')
        into   i_db_charset,i_db_charset_flag
        from   v$nls_parameters
        where  parameter   = 'NLS_CHARACTERSET';
Line: 232

        select 'Y'
        into   i_fnd_charset_flag
        from   fnd_lookups
        where  lookup_type = 'FND_ISO_CHARACTER_SET_MAP'
        and    lookup_code = ec_inbound_stage.g_source_charset;
Line: 327

	If matches , then Insert the Data for the previous level.
	**/

	For i in 1..i_level_info.COUNT
	loop
		if  ( next_rec_number = i_level_info(i).start_record_number )
			or ( end_of_file )
		then
			i_current_level := i;
Line: 395

				Insert Data into Staging table for Previous Level of Document .
				The value of the Insert Cursor for the First Call should be zero
				, and the rest of the calls can take the returned Cursor handle.
				This helps avoiding the Expensive Parsing for subsequent calls.
				**/
				Insert_into_Stage_table
					(
					i_previous_level,
					i_map_id,
					i_level_info(i_previous_level).Insert_Cursor
					);
Line: 561

	The Cursors for the Insert into Stage table are not closed in the Insert_Into_Stage_table
	procedure call. Since the Cursor handles are maintained in the I_LEVEL_INFO PL/SQL table ,
	Cursors for the all the Level are closed using these Cursor handles.
	**/
	For i in 1..i_level_info.COUNT
	loop
		IF dbms_sql.IS_OPEN(i_level_info(i).Insert_Cursor)
		then
			dbms_sql.Close_cursor(i_level_info(i).Insert_Cursor);
Line: 829

	SELECT  eic.interface_column_name,
		eic.staging_column,
		eic.record_number,
		eic.position,
		eic.width
	FROM    ece_interface_columns eic
	WHERE 	eic.external_level = p_level
	AND	eic.map_id = p_map_id
	AND	eic.record_number IS NOT NULL
	AND	eic.position IS NOT NULL
	AND	eic.staging_column IS NOT NULL
	ORDER BY eic.record_number, eic.position;
Line: 923

The Data loaded in the Local PL/SQL table is inserted into the Staging table.
This procedures takes Transaction Level and the Cursor handle as the parameter.
The Cursor handle is passed as 0 in the First call , and the subsequent calls
uses the Cursor Handle returned by the Procedure. This helps in avoiding the
expensive parsing of the SQL Statement again and again for the Same level.
**/
procedure Insert_Into_Stage_Table
	(
	i_level		IN	NUMBER,
	i_map_id	IN	NUMBER,
	i_insert_cursor	IN OUT NOCOPY	NUMBER
	)
is
c_Insert_Cursor		INTEGER;
Line: 937

cInsert_stmt		varchar2(32000) := 'INSERT INTO ECE_STAGE ( ';
Line: 944

ec_debug.push('EC_INBOUND_STAGE.INSERT_INTO_STAGE_TABLE');
Line: 946

ec_debug.pl(3,'i_insert_cursor',i_insert_cursor);
Line: 949

if i_insert_cursor = 0
then
	i_insert_cursor := -911;
Line: 954

if i_insert_cursor < 0
then
	--- Add Mandatory Columns for the Record - includes the MAP_ID column
	cInsert_stmt := cInsert_stmt||' Stage_id ,Document_Id ,Transaction_type ,Transaction_Level ,';
Line: 958

	cInsert_stmt := cInsert_stmt||' Line_Number ,Parent_Stage_Id ,Run_Id ,Document_Number ,Status ,Tp_Code ,Map_ID ,';
Line: 961

	-- cInsert_stmt := cInsert_stmt||' Parent_Stage_id ,Document_Id ,Transaction_type ,Transaction_Level ,';
Line: 962

	-- cInsert_stmt := cInsert_stmt||' Line_Number ,Stage_Id ,Run_Id ,Document_Number ,Status ,Tp_Code ,Map_ID ,';
Line: 965

	cInsert_stmt := cInsert_stmt||' creation_date ,created_by ,last_update_date ,last_updated_by ,';
Line: 979

			--- Build Insert Statement
			cInsert_stmt := cInsert_stmt||' '||i_stage_record_type(i).staging_column|| ',';
Line: 985

	cInsert_stmt := RTRIM(cInsert_stmt,',')||')';
Line: 987

	cInsert_stmt := cInsert_stmt||cValue_stmt;
Line: 990

	ec_debug.pl(3,'EC','ECE_STAGE_INSERT_LEVEL','LEVEL',i_level,null);
Line: 991

	ec_debug.pl(3,cInsert_stmt);
Line: 998

	i_Insert_Cursor := dbms_sql.Open_Cursor;
Line: 1000

		dbms_sql.parse(i_Insert_Cursor,cInsert_stmt,dbms_sql.native);
Line: 1004

		ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_INBOUND_STAGE.INSERT_INTO_STAGE_TABLE');
Line: 1005

		ece_error_handling_pvt.print_parse_error (error_position,cInsert_stmt);
Line: 1011

if i_Insert_Cursor > 0
then
	begin
                -- Bug 2164672
                if  i_data_status_flag then
                        i_level_info(i_level).Status := 'NEW';
Line: 1023

		dbms_sql.bind_variable (i_Insert_Cursor,'a1',to_number(i_level_info(i_level).Stage_Id));
Line: 1024

		dbms_sql.bind_variable (i_Insert_Cursor,'a6',i_level_info(i_level).Parent_Stage_Id);
Line: 1025

		dbms_sql.bind_variable (i_Insert_Cursor,'a2',to_number(i_level_info(i_level).Document_Id));
Line: 1026

		dbms_sql.bind_variable (i_Insert_Cursor,'a3',i_level_info(i_level).Transaction_Type);
Line: 1027

		dbms_sql.bind_variable (i_Insert_Cursor,'a4',to_number(i_level));
Line: 1028

		dbms_sql.bind_variable (i_Insert_Cursor,'a5',to_number(i_level_info(i_level).Line_Number));
Line: 1029

		dbms_sql.bind_variable (i_Insert_Cursor,'a7',to_number(i_level_info(i_level).Run_Id));
Line: 1030

		dbms_sql.bind_variable (i_Insert_Cursor,'a8',i_level_info(i_level).Document_Number);
Line: 1031

		dbms_sql.bind_variable (i_Insert_Cursor,'a9',i_level_info(i_level).Status);
Line: 1032

		dbms_sql.bind_variable (i_Insert_Cursor,'a10',i_level_info(i_level).Tp_Code);
Line: 1033

		dbms_sql.bind_variable (i_Insert_Cursor,'a11',i_map_id);
Line: 1037

		dbms_sql.bind_variable (i_Insert_Cursor,'w1',sysdate);
Line: 1038

		dbms_sql.bind_variable (i_Insert_Cursor,'w2',fnd_global.user_id);
Line: 1039

		dbms_sql.bind_variable (i_Insert_Cursor,'w3',sysdate);
Line: 1040

		dbms_sql.bind_variable (i_Insert_Cursor,'w4',fnd_global.user_id);
Line: 1056

		ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
Line: 1057

		ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
Line: 1066

							i_Insert_Cursor,
							'b'||k,
							i_stage_record_type(k).value
                                                        );
Line: 1088

		dummy := dbms_sql.execute(i_Insert_Cursor);
Line: 1091

			ec_debug.pl(3,'EC','ECE_STAGE_INSERTED',null);
Line: 1102

				'EC_INBOUND_STAGE.INSERT_INTO_STAGE_TABLE');
Line: 1105

		ec_debug.pl(0,cInsert_stmt);
Line: 1113

ec_debug.pl(3,'i_insert_cursor',i_insert_cursor);
Line: 1114

ec_debug.pop('EC_INBOUND_STAGE.INSERT_INTO_STAGE_TABLE');
Line: 1120

	IF dbms_sql.IS_OPEN(i_insert_cursor)
	then
		dbms_sql.close_cursor(i_insert_cursor);
Line: 1124

	ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_INBOUND_STAGE.INSERT_INTO_STAGE_TABLE');
Line: 1128

END Insert_Into_Stage_Table;
Line: 1156

        select  tp_code
        from    ece_tp_details td,
                hz_cust_acct_sites_all hcas,
                ece_tp_headers th
        where   td.translator_code       = i_translator_code and
                hcas.ece_tp_location_code  = i_location_code and
                hcas.tp_header_id          = td.tp_header_id and
                td.tp_header_id          = th.tp_header_id and
                td.document_id           = i_transaction_type and
                NVL(hcas.ORG_ID,NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1 ,1),
                ' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99))
                = NVL(TO_NUMBER(DECODE( SUBSTRB(USERENV('CLIENT_INFO'),1,1),
                ' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99) and
                rownum                   = 1;
Line: 1179

   	select 	tp_code
   	from   	ece_tp_details td,
          	ra_addresses   ra,
		ece_tp_headers th
   	where  	td.translator_code       = i_translator_code and
          	ra.ece_tp_location_code  = i_location_code and
          	ra.tp_header_id          = td.tp_header_id and
		td.tp_header_id		 = th.tp_header_id and
          	td.document_id           = i_transaction_type and
          	rownum                   = 1;
Line: 1198

   	select 	tp_code
   	from   	ece_tp_details td,
          	po_vendor_sites pvs,
		ece_tp_headers th
   	where  	td.translator_code       = i_translator_code and
          	pvs.ece_tp_location_code = i_location_code and
          	pvs.tp_header_id         = td.tp_header_id and
          	th.tp_header_id         = td.tp_header_id and
          	td.document_id           = i_transaction_type and
          	rownum                   = 1;
Line: 1216

   	select 	tp_code
   	from   	ece_tp_details td,
          	ap_bank_branches abb,
		ece_tp_headers th
   	where  	td.translator_code       = i_translator_code and
          	abb.ece_tp_location_code = i_location_code and
          	abb.tp_header_id         = td.tp_header_id and
          	th.tp_header_id          = td.tp_header_id and
          	td.document_id           = i_transaction_type and
          	rownum                   = 1;
Line: 1235

   	select 	tp_code
   	from   	ece_tp_details td,
          	hr_locations hrl,
		ece_tp_headers th
   	where  	td.translator_code       = i_translator_code and
          	hrl.ece_tp_location_code = i_location_code and
          	hrl.tp_header_id         = td.tp_header_id and
          	th.tp_header_id          = td.tp_header_id and
          	td.document_id           = i_transaction_type and
          	rownum                   = 1;