DBA Data[Home] [Help]

APPS.IEM_EMAIL_PROC_PVT SQL Statements

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

Line: 82

	ERR_INSERTING		EXCEPTION;
Line: 97

	select classification_id from iem_email_classifications
	where message_id=l_message_id
	order by score desc;
Line: 171

   cursor c_item is select ib.item_id,ib.item_name,ib.last_update_date
   from   amv_c_chl_item_match cim,jtf_amv_items_vl ib
   where  cim.channel_category_id = l_cm_cat_id
   and   cim.channel_id is null
   and   cim.approval_status_type ='APPROVED'
   and   cim.table_name_code ='ITEM'
   and   cim.available_for_channel_date <= sysdate
   and   cim.item_id = ib.item_id
   and    nvl(ib.effective_start_date, sysdate) <= sysdate + 1
   and   nvl(ib.expiration_date, sysdate) >= sysdate;
Line: 186

 cursor c_intent is select a.intent,b.score from
 iem_intents a,iem_email_classifications b
 where b.message_id=l_message_id
 and a.intent_id=b.classification_id
 order by b.score desc;
Line: 240

	select * into l_header_Rec
	from iem_ms_base_headers
	where message_id=l_message_id;
Line: 243

	select user_name,kem_flag,email_address,account_type
	into l_email_user_name,l_intent_flg,l_email_address,l_acct_type
	from iem_mstemail_accounts
	where email_account_id=l_post_rec.email_account_id;
Line: 294

	l_tag_keyval.delete;
Line: 445

		select value into l_thread_id
		from IEM_ENCRYPTED_TAG_DTLS
		where key ='IEMNTHREADID' and encrypted_id = substr(l_encrypted_id,1,5);
Line: 449

		select agent_id into l_agentid from
		IEM_ENCRYPTED_TAGS where encrypted_id = substr(l_encrypted_id,1,5);
Line: 452

				l_logmessage:=l_logmessage || '-error while selecting '||sqlerrm;
Line: 459

fix for bug 13797286 . Don't insert into IEM_THREAD_DTLS if the message is redirected or rerouted.
*/


	IF l_thread_id IS NOT NULL AND nvl(l_post_rec.msg_status,'NEW') not in
	('REDIRECT','REROUTE') THEN


	if g_statement_log then
		l_logmessage:='start insertion to  IEM_THREAD_DTLS';
Line: 472

		insert into IEM_THREAD_DTLS(
		THREAD_ID,
		MESSAGE_ID,
		MESSAGE_TYPE,
		CREATED_BY,
		CREATION_DATE,
		LAST_UPDATED_BY,
		LAST_UPDATE_DATE,
		LAST_UPDATE_LOGIN)
		values(l_thread_id, l_post_rec.message_id,'I',l_agentid,sysdate, l_agentid,sysdate,l_agentid);
Line: 530

  		 Select person_id into l_contact_id
  		 from per_workforce_current_x
  		 Where upper(email_address)=upper(l_sender);
Line: 612

		l_class_val_tbl.delete;
Line: 736

	select name
	into l_folder_name
	from iem_route_classifications
	where route_classification_id=l_rt_classification_id;
Line: 831

			 	select PARTY_TYPE into l_party_type from HZ_PARTIES
			   	where party_id = l_tag_custid;
Line: 901

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_interaction_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 916

			    	select contact_party_id into l_cust_contact_id from jtf_ih_interactions
				where interaction_id=l_interaction_id;
Line: 962

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_media_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 982

ELSE									-- Rerouted Message Need to update the media item
	l_media_rec.media_id:=l_post_rec.ih_media_item_id;
Line: 990

	l_logmessage:='Before calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH media';
Line: 997

				p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_media_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1009

		l_logmessage:='After calling IEM_EMAIL_PROC_PVT.IEM_PROC_IH media update: status : '||l_stat || 'text : '|| l_out_text || 'l_media_id : ' ||l_media_id;
Line: 1046

		l_logmessage:='Before calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH MLCS add';
Line: 1052

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1063

		l_logmessage:='After calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH MLCS add :status : '||l_stat ||' text : '||l_out_text||' l_milcs_id :'||l_milcs_id;
Line: 1072

	-- Update  the Media Life Cycle for Mail Preprocessing
  l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 1077

				p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1088

		l_logmessage:='After calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH MLCS add :status : '||l_stat ||' text : '||l_out_text||' l_milcs_id :'||l_milcs_id;
Line: 1106

		l_logmessage:='Before calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH MLCS update';
Line: 1112

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_mp_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1123

		l_logmessage:='After calling update IEM_EMAIL_PROC_PVT.IEM_PROC_IH MLCS update :status : '||l_stat ||' text : '||l_out_text||' l_milcs_id :'||l_milcs_id;
Line: 1147

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_activity_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1171

									p_rule_type=>'AUTODELETE',
									p_keyvals_tbl=>l_class_val_tbl,
									p_accountid=>l_post_rec.email_account_id,
									x_result=>l_autoproc_result,
									x_action=>l_action,
									x_parameters=>l_param_rec_tbl,
									x_return_status=>l_ret_status,
									x_msg_count=>l_msg_count,
									x_msg_data=>l_msg_data);
Line: 1181

				l_logmessage:='Error While Calling rules Engine for Autodelete';
Line: 1184

	IF l_autoproc_result='T' THEN		-- Delete the message
	 -- Create a New MLCS for AUTO_DELETE
  		l_media_lc_rec.media_id :=l_media_id ;
Line: 1187

  		l_media_lc_rec.milcs_type_id := 42; --EMAIL_AUTO_DELETE
Line: 1201

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1219

			-- Update  the Media Life Cycle for Auto Delete
 			 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 1230

				p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1250

			-- Add a Activity for AUTO-DELETE
     				l_activity_rec.start_date_time   := SYSDATE;
Line: 1253

         				l_activity_rec.action_id         := 72;	-- EMAIL AUTO _DELETED
Line: 1265

				p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_activity_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 1326

				l_logmessage:='AUTODELETE:Error While Inserting Record in Proc Emails Table ';
Line: 1352

				l_logmessage:='Error in Auto Delete '||l_out_text;
Line: 1362

		select count(*) into l_autoack_count
		from jtf_ih_media_item_lc_segs
		where media_id=l_post_rec.ih_media_item_id
		and MILCS_TYPE_ID=29;
Line: 1404

					l_param_rec_tbl.delete;
Line: 1450

							l_run_proc_tbl.delete;
Line: 1485

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_activity_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 1518

									p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
									p_interaction_rec=>l_interaction_rec,
									p_activity_rec=>l_activity_rec     ,
									p_media_lc_rec=>l_media_lc_Rec ,
									p_media_rec=>l_media_rec	,
									x_id=>l_milcs_id,
									x_status=>l_stat		,
			     					x_out_text=>l_out_text	);
Line: 1537

			-- Update  the Media Life Cycle for Auto Resolve
 			 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 1542

							l_logmessage:='Calling update MLCS IEM_EMAIL_PROC_PVT.IEM_PROC_IH for milcs id 31 ';
Line: 1548

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 1560

							l_logmessage:='After update MLCS IEM_EMAIL_PROC_PVT.IEM_PROC_IH for milcs id 31 staus : '||l_stat||' text : '||l_out_text||' l_milcs_id : '||l_milcs_id;
Line: 1572

		l_logmessage:='Calling IEM_RT_PROC_EMAILS_PVT.create_item after update mlcs 31';
Line: 1607

				l_logmessage:='After update MLCS IEM_EMAIL_PROC_PVT.IEM_PROC_IH for milcs id 31 staus : '||l_stat||' text : '||l_out_text||' l_milcs_id : '||l_milcs_id;
Line: 1612

				l_logmessage:='EXECPROC:Error While Inserting Record in Proc Emails Table ';
Line: 1615

				-- Add a Activity for AUTO-UPDATE OF SR if the incoming email contain reference to SR
				  if l_sr_id is not null then
     					l_activity_rec.start_date_time   := SYSDATE;
Line: 1619

         				l_activity_rec.action_id         := 75;	-- Auto Update Of SR
Line: 1626

							p_action=>'ADD',	-- ADD/UPDATE/CLOSE
							p_interaction_rec=>l_interaction_rec,
							p_activity_rec=>l_activity_rec,
							p_media_lc_rec=>l_media_lc_Rec,
							p_media_rec=>l_media_rec,
							x_id=>l_activity_id,
							x_status=>l_stat,
			     				x_out_text=>l_out_text	);
Line: 1646

				l_logmessage:='Calling IEM_EMAIL_PROC_PVT.IEM_WRAPUP after update mlcs 31';
Line: 1660

				l_logmessage:='End of  IEM_EMAIL_PROC_PVT.IEM_WRAPUP after update mlcs 31 status : '||l_stat ||' data: '||l_out_text;
Line: 1677

			 -- Populate l_email_doc_tbl for both autocreate and autoupdate SR
					FOR l_param_index in l_param_rec_tbl.FIRST..l_param_rec_tbl.LAST LOOP
					-- Added NVL condition for bug 11796985
					l_status_id:=to_number(NVL(l_param_rec_tbl(l_param_index).parameter1,'0'));
Line: 1692

				l_qual_tbl.delete;
Line: 1718

						if l_acct_type='I' then -- select the party id from profile
							l_emp_flag:='Y';
Line: 1721

						 Select person_id into l_contact_id
						 from per_workforce_current_x
						 Where upper(email_address)=upper(l_sender);
Line: 1746

								select party_type into l_party_type from  hz_parties
								where party_id=l_customer_id;
Line: 1751

								select object_id into l_party_id
								from HZ_RELATIONSHIPS where party_id= l_customer_id and
								(relationship_code='CONTACT_OF' or relationship_code='EMPLOYEE_OF')
								and status='A';
Line: 1756

								select contact_point_id  into l_contact_point_id
    								from hz_contact_points
    								where owner_table_name='HZ_PARTIES'
								and owner_table_id=l_customer_id
								and contact_point_type='EMAIL'
								and upper(email_address)=upper(l_sender)
    								and contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
    								where contact_level_table='HZ_CONTACT_POINTS' and status='A');
Line: 1983

								l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_PROC_IH add activity for auto update sr';
Line: 1988

									p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
									p_interaction_rec=>l_interaction_rec,
									p_activity_rec=>l_activity_rec     ,
									p_media_lc_rec=>l_media_lc_Rec ,
									p_media_rec=>l_media_rec	,
									x_id=>l_milcs_id,
									x_status=>l_stat		,
			     					x_out_text=>l_out_text	);
Line: 1999

								l_logmessage:='after IEM_EMAIL_PROC_PVT.IEM_PROC_IH add activity for auto update sr : status :  '||l_stat||' text :'||l_out_text||' act id : '||l_activity_id;
Line: 2011

								l_logmessage:='calling IEM_RT_PROC_EMAILS_PVT.create_item after auto update sr';
Line: 2045

				l_logmessage:='after IEM_RT_PROC_EMAILS_PVT.create_item after auto update sr : status :'||l_ret_status ||' data : '||l_msg_data;
Line: 2051

				l_logmessage:='AUTOCREATESR:Error While Inserting Record in Proc Emails Table '||'sqlerrm:'||sqlerrm;
Line: 2056

							-- Update  the Media Life Cycle for Auto Create  SR
 							 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 2061

				l_logmessage:='update interaction for auto update sr';
Line: 2066

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 2076

				l_logmessage:='END IEM_EMAIL_PROC_PVT.IEM_PROC_IH update interaction for auto update sr : status : '||l_stat||' text :'||l_out_text|| ' inter id : '||l_id;
Line: 2103

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_activity_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 2122

					-- select result reason outcome for activity
					select wu.outcome_id, wu.result_id, wu.reason_id INTO
 					l_activity_rec.outcome_id, l_activity_rec.result_id, l_activity_rec.reason_id
        				from jtf_ih_action_action_items aa, jtf_ih_wrap_ups wu
        				where aa.action_id =65
					and aa.action_item_id =45
        				and aa.default_wrap_id = wu.wrap_id;
Line: 2138

						select incident_number into l_activity_rec.doc_source_object_name
						from cs_incidents_all_b where incident_id=l_sr_id;
Line: 2148

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_activity_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 2166

					-- Update the mail Processing Life Cycles
 							 l_media_lc_rec.milcs_id:=l_mp_milcs_id;
Line: 2171

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 2187

					-- update the itneraction with result reason outcome
					select wu.outcome_id, wu.result_id, wu.reason_id INTO
 					l_interaction_rec.outcome_id, l_interaction_rec.result_id, l_interaction_rec.reason_id
        				from jtf_ih_action_action_items aa, jtf_ih_wrap_ups wu
        				where aa.action_id =65
					and aa.action_item_id =45
        				and aa.default_wrap_id = wu.wrap_id;
Line: 2195

				select contact_party_id into l_cust_contact_id from jtf_ih_interactions
				where interaction_id=l_interaction_id;
Line: 2199

								p_action=>'CLOSE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 2215

				l_logmessage:='calling iem_email_proc_pvt.IEM_AUTOREPLY for auot update sr';
Line: 2235

				l_logmessage:='END iem_email_proc_pvt.IEM_AUTOREPLY for auot update sr : status : '||l_stat ||' data : '||l_out_text;
Line: 2249

				l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_WRAPUP for resolve on auto update sr';
Line: 2262

				l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_WRAPUP for resolve on auto update sr status : '||l_stat||' data :'||l_out_text;
Line: 2273

						 	if (fnd_profile.value_specific('IEM_SR_NOT_UPDATED'))='REDIRECT'
 then
 							l_redirect_flag:='Y';
Line: 2282

				ELSE 	-- This is a update service request
					IF (l_status_id is not null) and (l_sr_id is not null) then
						-- If l_status id is 0 which means user do not want to update status
						-- so do not call the update status API
						If l_status_id=0 then
						  	l_stat:='S';
Line: 2292

				l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_SRSTATUS_UPDATE for auto update sr';
Line: 2296

							IEM_EMAIL_PROC_PVT.IEM_SRSTATUS_UPDATE(p_sr_id=>l_sr_id	,
												p_status_id=>l_status_id,
												p_email_rec=>l_post_rec,
												x_status =>l_stat,
												x_out_text=>l_out_text) ;
Line: 2303

				l_logmessage:='after IEM_EMAIL_PROC_PVT.IEM_SRSTATUS_UPDATE for auto update l_out_textsr : status : '||l_stat||' text : '||l_out_text;
Line: 2308

						-- Add a Activity for AUTO-UPDATE OF SR
     					l_activity_rec.start_date_time   := SYSDATE;
Line: 2311

         					l_activity_rec.action_id         := 75;	-- Auto Update Of SR
Line: 2318

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_activity_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 2331

					--Update Intearctionwith result reason outcome
					-- Create a Media Life Cycle for Auto update of SR
  						l_media_lc_rec.media_id :=l_media_id ;
Line: 2334

  						l_media_lc_rec.milcs_type_id := 40; --EMAIL_AUTO_UPDATED_SR
Line: 2340

				l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS for auto ack';
Line: 2346

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			    				 x_out_text=>l_out_text	);
Line: 2356

				l_logmessage:='END IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS for auto ack :  status : '||l_stat||' txt : '||l_out_text||' mlcs id : '||l_milcs_id;
Line: 2364

							-- Update  the Media Life Cycle for Auto Update of SR
 							 l_media_lc_rec.milcs_id:=l_id;
Line: 2368

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 2410

				l_logmessage:='AUTOUPDSR:Error While Inserting Record in Proc Emails Table ';
Line: 2414

				l_noti_flag:=FND_PROFILE.VALUE_SPECIFIC('IEM_SR_UPDATE_NOTI');
Line: 2417

					-- update the itneraction with result reason outcome
					select wu.outcome_id, wu.result_id, wu.reason_id INTO
 					l_interaction_rec.outcome_id, l_interaction_rec.result_id, l_interaction_rec.reason_id
        				from jtf_ih_action_action_items aa, jtf_ih_wrap_ups wu
        				where aa.action_id =75
					and aa.action_item_id =45
        				and aa.default_wrap_id = wu.wrap_id;
Line: 2427

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			     				x_out_text=>l_out_text	);
Line: 2441

				l_outbox_tbl.delete;
Line: 2471

					-- Update the mail Processing Life Cycles
 							 l_media_lc_rec.milcs_id:=l_mp_milcs_id;
Line: 2476

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 2507

						 	if (fnd_profile.value_specific('IEM_SR_NOT_UPDATED'))='REDIRECT'
 then
 							l_redirect_flag:='Y';
Line: 2512

					END IF;	-- if l_stat='S' from SR update api
Line: 2520

			END IF;		-- elsif l_Action in ('AUTOCREATESR','AUTOUPDATESR');
Line: 2556

						p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
						p_interaction_rec=>l_interaction_rec,
						p_activity_rec=>l_activity_rec     ,
						p_media_lc_rec=>l_media_lc_Rec ,
						p_media_rec=>l_media_rec	,
						x_id=>l_milcs_id,
						x_status=>l_stat		,
			   	  	     x_out_text=>l_out_text	);
Line: 2568

						p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
						p_interaction_rec=>l_interaction_rec,
						p_activity_rec=>l_activity_rec     ,
						p_media_lc_rec=>l_media_lc_Rec ,
						p_media_rec=>l_media_rec	,
						x_id=>l_milcs_id,
						x_status=>l_stat		,
			     		x_out_text=>l_out_text	);
Line: 2580

	-- set for  autocreate/auto update SR fails for employee type
	if l_redirect_flag='N' then
	iem_rules_engine_pub.auto_process_email(p_api_version_number=>1.0,
									p_commit=>FND_API.G_FALSE,
									p_rule_type=>'AUTOREDIRECT',
									p_keyvals_tbl=>l_class_val_tbl,
									p_accountid=>l_post_rec.email_account_id,
									x_result=>l_autoproc_result,
									x_action=>l_action,
									x_parameters=>l_param_rec_tbl,
									x_return_status=>l_ret_status,
									x_msg_count=>l_msg_count,
									x_msg_data=>l_msg_data);
Line: 2597

		else		-- As auto redirect flag is set for autoupdate/create SR
			l_autoproc_result:='T';
Line: 2623

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			    				 x_out_text=>l_out_text	);
Line: 2635

							-- Update  the Media Life Cycle for Auto RRRR
 							 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 2639

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 2662

				l_outbox_tbl.delete;
Line: 2663

				l_qual_tbl.delete;
Line: 2717

				delete from iem_email_classifications where message_id=l_post_rec.message_id;
Line: 2718

				-- Fix for bug 14010115 ,update ih_interaction_id also with latest interaction_id in case new interaction is created.
				-- else, row will be updated with old interaction id, in case of auto-redirect rule.
				update iem_rt_preproc_emails
				set email_account_id=l_redirect_id,
				ih_interaction_id=l_interaction_id,
				msg_status='REDIRECT',
				ih_media_item_id=l_media_id
				where message_id=l_post_rec.message_id;
Line: 2791

				l_outbox_tbl.delete;
Line: 3017

		update iem_rt_proc_emails
		set resource_id=l_agentid
		where message_id=l_post_rec.message_id;
Line: 3038

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			    				 x_out_text=>l_out_text	);
Line: 3059

							-- Update  the Media Life Cycle for Auto Routing
                 if l_stat='S' then
 							 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 3067

		l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS for email inbound auto route ';
Line: 3072

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 3083

		l_logmessage:='end IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS for email inbound auto route status : '||l_stat||' text : '||l_out_text||' id : '||l_milcs_id;
Line: 3096

			-- In case of autoroute update the interaction with resource id of the agent to which
			-- the message is autorouted to
			l_interaction_rec.interaction_id:=l_interaction_id;
Line: 3103

		l_logmessage:='calling JTF_IH_PUB.Update_Interaction ';
Line: 3107

     		JTF_IH_PUB.Update_Interaction( p_api_version     => 1.1,
                                  p_resp_appl_id    => TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
                                  p_resp_id         => TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
                         		p_user_id		  =>nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1),
							p_login_id	  =>TO_NUMBER(FND_PROFILE.VALUE('LOGIN_ID')),
                                  x_return_status   => l_ret_status,
                                  x_msg_count       => l_msg_count,
                                  x_msg_data        => l_msg_data,
                                  p_interaction_rec => l_interaction_rec
                                 );
Line: 3119

		l_logmessage:='end JTF_IH_PUB.Update_Interaction status'||l_ret_status || ' txt : '||l_msg_data;
Line: 3142

		raise ERR_INSERTING;
Line: 3144

	-- Update  the Media Life Cycle for Mail processing
  l_media_lc_rec.milcs_id:=l_mp_milcs_id;
Line: 3150

		l_logmessage:='calling IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS after JTF call ';
Line: 3156

				p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
				p_interaction_rec=>l_interaction_rec,
				p_activity_rec=>l_activity_rec     ,
				p_media_lc_rec=>l_media_lc_Rec ,
				p_media_rec=>l_media_rec	,
				x_id=>l_milcs_id,
				x_status=>l_stat		,
			     x_out_text=>l_out_text	);
Line: 3167

		l_logmessage:='end IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS after JTF call : status : '||l_stat||' txt : '||l_out_text||' id : '||l_milcs_id;
Line: 3175

	delete from iem_rt_preproc_emails
	where message_id=l_post_rec.message_id;
Line: 3199

		select count(*) into l_kb_rank
		from iem_doc_usage_stats
		where kb_doc_id=v_item.item_id;
Line: 3212

 p_doc_last_modified_date=>v_item.last_update_date,
 			p_score =>l_kb_rank,
 			p_url =>' ',
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_ret_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 3251

					-- Update  the Media Life Cycle for Mail processing  -- no need to call wrapup
 								 l_media_lc_rec.milcs_id:=l_mp_milcs_id;
Line: 3256

		l_logmessage:=' Calling iem_email_proc_pvt.IEM_PROC_IH update MLCS in STOP_AUTO_PROCESS';
Line: 3261

										p_action=>'UPDATE'	,	-- ADD/UPDATE/CLOSE
										p_interaction_rec=>l_interaction_rec,
										p_activity_rec=>l_activity_rec     ,
										p_media_lc_rec=>l_media_lc_Rec ,
										p_media_rec=>l_media_rec	,
										x_id=>l_milcs_id,
										x_status=>l_stat		,
			    						 x_out_text=>l_out_text	);
Line: 3271

		l_logmessage:=' End  iem_email_proc_pvt.IEM_PROC_IH update MLCS in STOP_AUTO_PROCESS :status : '||l_stat||' txt :'||l_out_text||' id : '||l_milcs_id;
Line: 3285

										update iem_rt_preproc_emails
										set creation_date=sysdate
										where message_id=l_post_rec.message_id;
Line: 3333

										l_logmessage:='AUTOREPLY:Error While Inserting Record in Proc Emails Table ';
Line: 3340

										update iem_rt_preproc_emails
										set creation_date=sysdate
										where message_id=l_post_rec.message_id;
Line: 3345

											delete from iem_rt_preproc_emails where message_id=l_post_rec.message_id;
Line: 3350

		delete from iem_rt_preproc_emails
		where message_id=l_post_rec.message_id;
Line: 3405

						p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
						p_interaction_rec=>l_interaction_rec,
						p_activity_rec=>l_activity_rec     ,
						p_media_lc_rec=>l_media_lc_Rec ,
						p_media_rec=>l_media_rec	,
						x_id=>l_milcs_id,
						x_status=>l_stat		,
			   	  	     x_out_text=>l_out_text	);
Line: 3424

			l_logmessage:='call to IEM_EMAIL_PROC_PVT.IEM_PROC_IH update MLCS in else statement of stop_processing';
Line: 3430

						p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
						p_interaction_rec=>l_interaction_rec,
						p_activity_rec=>l_activity_rec     ,
						p_media_lc_rec=>l_media_lc_Rec ,
						p_media_rec=>l_media_rec	,
						x_id=>l_milcs_id,
						x_status=>l_stat		,
			     		x_out_text=>l_out_text	);
Line: 3450

   WHEN STOP_REDIRECT_PROCESSING THEN		-- Here record can not be deleted from preproc_emails table
	if g_statement_log then
      l_Error_Message := 'stop Further Processing';
Line: 3464

	update iem_rt_preproc_emails
	set creation_date=sysdate
	where message_id=l_post_rec.message_id;
Line: 3469

   WHEN ERR_INSERTING THEN
	if g_exception_log then
   		l_logmessage := 'Unable To insert Record in Post MDT '||sqlerrm;
Line: 3476

	update iem_rt_preproc_emails
	set creation_date=sysdate
	where message_id=l_post_rec.message_id;
Line: 3492

	update iem_rt_preproc_emails
	set creation_date=sysdate
	where message_id=l_post_rec.message_id;
Line: 3560

	for x in ( select message_id
 	from iem_rt_preproc_emails
 	order by priority,creation_date)
LOOP
BEGIN
	select * into x_msg_rec from iem_rt_preproc_emails
	where message_id=x.message_id FOR UPDATE NOWAIT;
Line: 3620

	-- Selecting Auto Ack. Subject which will be appended to original mail
	BEGIN
	select meaning||': '
	into l_ack_sub
	from fnd_lookups
	where lookup_type='IEM_AUTO_ACKNOWLEDGE'
	and lookup_code='SUBJECT';
Line: 3663

			IEM_OUTBOX_PROC_PUB.insertDocument(
 			   p_api_version_number=>1.0    ,
   			   p_outbox_item_id=>l_outbox_id,
                  p_document_source=>'MES'       ,
                  p_document_id =>p_document_id ,
                  X_RETURN_STATUS=>l_ret_status,
			   X_MSG_COUNT=>l_msg_count,
 			   X_MSG_DATA=>l_msg_data);
Line: 3672

		x_out_text:='Failed in insert document  '||l_text_data;
Line: 3756

		select value into l_outval
		from iem_comp_rt_stats
		where type='WORKFLOW' AND param=to_char(p_message_id);
Line: 3765

			select classification_id into l_class
			from iem_email_classifications
			where message_id=p_message_id
			and score = (select max(score) from iem_email_classifications
			where message_id=p_message_id)
			and rownum=1;
Line: 3782

   SELECT TO_CHAR(iem.IEM_MAILPREPROCWF_S1.nextval)
   INTO l_itemkey
   FROM dual;
Line: 3851

PROCEDURE		IEM_SRSTATUS_UPDATE(p_sr_id	in number,
							p_status_id in number,
							p_email_rec in iem_rt_preproc_emails%rowtype,
							x_status  out NOCOPY varchar2,
							x_out_text out NOCOPY varchar2) IS

l_service_request_rec          CS_ServiceRequest_PUB.service_request_rec_type;
Line: 3878

			-- code for auto sr update
		x_status:='S';
Line: 3880

				-- select object version number
		BEGIN
			open c1 for
				'select object_version_number,status_flag from cs_incidents_all_b where incident_id=:sr_id' using p_sr_id;
Line: 3889

			x_out_Text:='Oracle Error for SR# '||p_sr_id|| 'While selecting object version number '||sqlerrm;
Line: 3896

		IF l_status_flag<>'C' THEN		-- SR is not closed so we can update
			l_status_id:=p_status_id;
Line: 3898

 		     IEM_ServiceRequest_PVT.Update_Status_Wrap
  				( p_api_version =>2.0,
    				p_init_msg_list =>fnd_api.g_true,
				p_commit => fnd_api.g_false,
                    p_resp_appl_id  => TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
                    p_resp_id       => TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
                   	p_user_id		  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
       			x_return_status =>l_ret_status,
    				x_msg_count=>l_msg_count,
    				x_msg_data =>l_msg_data,
    				p_request_id =>p_sr_id,
				p_object_version_number =>l_object_version_number,
				p_status_id=>l_status_id,
				p_status=>l_sr_status,
 				x_interaction_id=>l_interaction_id);
Line: 3914

				x_out_text:='SR update Status Api fails for SR# '||p_sr_id;
Line: 3922

		x_out_text:='Successfully Update the SR '||p_sr_id;
Line: 3925

			x_out_text:='SR '||p_sr_id||' is Closed  Hence Not updated ';
Line: 4007

				p_action		in varchar2,		-- ADD/UPDATE/CLOSE
 				p_interaction_rec IN       JTF_IH_PUB.interaction_rec_type,
				p_activity_rec      IN     JTF_IH_PUB.activity_rec_type,
				p_media_lc_rec IN  JTF_IH_PUB.media_lc_rec_type,
				p_media_rec	IN  JTF_IH_PUB.media_rec_type,
				x_id			OUT NOCOPY NUMBER,
				x_status		out NOCOPY varchar2,
			     x_out_text	out NOCOPY  varchar2) IS
	l_media_id		number;
Line: 4049

		  elsif p_action='UPDATE' THEN

  				JTF_IH_PUB.Update_MediaItem( 1.0,
						'T',
						'F',
						TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
						TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
						nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1),
						TO_NUMBER(FND_PROFILE.VALUE('LOGIN_ID')),
						l_ret_status,
						l_msg_count,
						l_msg_data,
						p_media_rec);
Line: 4105

		elsif p_action='UPDATE' THEN
  			JTF_IH_PUB.Update_MediaLifeCycle( 1.0,
						'T',
						'F',
						TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
						TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
						nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1),
						TO_NUMBER(FND_PROFILE.VALUE('LOGIN_ID')),
						l_ret_status,
						l_msg_count,
						l_msg_data,
						p_media_lc_rec);
Line: 4142

		ELSIF p_action='UPDATE' THEN
     		JTF_IH_PUB.Update_Interaction( p_api_version     => 1.1,
                                  p_resp_appl_id    => TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
                                  p_resp_id         => TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
                         		p_user_id		  =>nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1),
							p_login_id	  =>TO_NUMBER(FND_PROFILE.VALUE('LOGIN_ID')),
                                  x_return_status   => l_ret_status,
                                  x_msg_count       => l_msg_count,
                                  x_msg_data        => l_msg_data,
                                  p_interaction_rec => p_interaction_rec
                                 );
Line: 4176

					select wu.outcome_id, wu.result_id, wu.reason_id INTO
 					l_activity_rec.outcome_id, l_activity_rec.result_id, l_activity_rec.reason_id
        				from jtf_ih_action_action_items aa, jtf_ih_wrap_ups wu
        				where aa.action_id =l_activity_rec.action_id
					and aa.action_item_id = l_activity_rec.action_item_id
        				and aa.default_wrap_id = wu.wrap_id;
Line: 4246

					-- Update the mail Processing Life Cycles
 							 l_media_lc_rec.milcs_id:=p_milcs_id;
Line: 4250

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 4267

									select wu.outcome_id, wu.result_id, wu.reason_id into
 									l_interaction_rec.outcome_id,
									l_interaction_rec.result_id,
									l_interaction_rec.reason_id
        								from jtf_ih_action_action_items aa, jtf_ih_wrap_ups wu
        								where aa.action_id =p_action_id
									and aa.action_item_id = 45
        								and aa.default_wrap_id = wu.wrap_id;
Line: 4280

								p_action=>'CLOSE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_interaction_id,
								x_status=>l_stat		,
			  				     x_out_text=>l_out_text	);
Line: 4296

									p_action=>'CLOSE'		,		-- ADD/UPDATE/CLOSE
									p_interaction_rec=>l_interaction_rec,
									p_activity_rec=>l_activity_rec     ,
									p_media_lc_rec=>l_media_lc_Rec ,
									p_media_rec=>l_media_rec	,
									x_id=>l_interaction_id,
									x_status=>l_stat		,
			   			 		 	x_out_text=>l_out_text	);
Line: 4364

select * into l_header_rec from iem_ms_base_headers
where message_id=p_post_rec.message_id;
Line: 4404

		IEM_OUTBOX_PROC_PUB.insertDocument(
   		 p_api_version_number=>1.0    ,
  		  p_outbox_item_id=>l_outbox_id,
  		  p_document_source=>'MES'       ,
   		 p_document_id =>p_doc_tbl(i).doc_id ,
		 X_RETURN_STATUS=>l_ret_status,
		 X_MSG_COUNT=>l_msg_count,
		 X_MSG_DATA=>l_msg_data);
Line: 4414

			x_out_text:='Error Encountered While Calling Insert Document ';
Line: 4419

		SELECT fl.file_name
		INTO l_file_name
		FROM jtf_amv_items_tl b ,jtf_amv_attachments a ,fnd_lobs fl
		WHERE b.item_id = a.attachment_used_by_id
		and a.attachment_used_by='ITEM'
		AND a.file_id = fl.file_id
		AND b.item_id=p_doc_tbl(i).doc_id
		AND b.language=USERENV('LANG')
		and rownum=1;
Line: 4491

		IEM_OUTBOX_PROC_PUB.insertDocument(
   		 p_api_version_number=>1.0    ,
  		  p_outbox_item_id=>l_outbox_id,
  		  p_document_source=>'MES'       ,
   		 p_document_id =>l_notification_id ,
		 X_RETURN_STATUS=>l_ret_status,
		 X_MSG_COUNT=>l_msg_count,
		 X_MSG_DATA=>l_msg_data);
Line: 4501

			x_out_text:='Error Encountered While Calling Insert Document ';
Line: 4553

					IEM_OUTBOX_PROC_PUB.insertDocument(
   		 			p_api_version_number=>1.0    ,
  		  			p_outbox_item_id=>l_outbox_id,
  		 			 p_document_source=>'MES'       ,
   					 p_document_id =>p_fwd_doc_id ,
					 X_RETURN_STATUS=>l_ret_status,
					 X_MSG_COUNT=>l_msg_count,
					 X_MSG_DATA=>l_msg_data);
Line: 4563

				  x_out_text:='Error Encountered While Calling Insert Document during autoforward';
Line: 4602

	cursor c1 is select lookup_code,meaning
	from fnd_lookups
	where enabled_flag = 'Y'
	AND NVL(start_date_active, SYSDATE) <= SYSDATE
	AND NVL(end_date_active,SYSDATE) >= SYSDATE
	AND lookup_type ='IEM_MERGE_FIELDS'
	ANd lookup_code like 'ACK%';
Line: 4615

	select from_name,reply_to_address
	INTO l_from_name,l_reply_address
	from IEM_MSTEMAIL_ACCOUNTS
	where email_account_id=p_email_account_id;
Line: 4627

		x_qual_tbl.delete;
Line: 4712

 SELECT a.intent_id, a.keyword,a.weight
 from iem_intent_dtls a,iem_account_intents b
WHERE   b.email_account_id=l_email_account_id
AND a.intent_id=b.intent_id
AND QUERY_RESPONSE='Q'
and weight>0
order by 1;
Line: 4720

   SELECT keyword,weight FROM iem_intent_dtls
   where intent_id=l_class_id
   AND QUERY_RESPONSE='Q'
   and weight>0
   order by 2 desc;
Line: 4727

	select kem_flag,account_language
	INTO l_theme_code,l_lang
	FROM IEM_MSTEMAIL_ACCOUNTS
	WHERE EMAIL_ACCOUNT_ID=l_email_account_id;
Line: 4731

		l_theme_buf.delete;
Line: 4732

		l_token_buf.delete;
Line: 4808

	 FOR x in (select * from the(select cast(l_data as iem_class_tbl_typ)
	  from dual)a where score>0 and rownum<8 order by score desc)
	  LOOP
		l_wtot:=l_wtot+x.score;
Line: 4813

	 FOR x in (select * from the(select cast(l_data as iem_class_tbl_typ)
	  from dual)a where score>0 and rownum<8 order by score desc)
	  LOOP
		x.score:=x.score*100/l_wtot;
Line: 4825

	select intent into g_topclass
	from iem_intents
	where intent_id=l_gclassid;
Line: 4847

               p_LAST_UPDATED_BY=>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')) ,
               p_LAST_UPDATE_DATE=>SYSDATE,
               p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ ID')) ,
          x_return_Status=>l_status,
          x_msg_count=>l_count,
          x_msg_data=>l_msg_data);
Line: 4890

 cursor c_intent is select a.intent,b.score from
 iem_intents a,iem_email_classifications b
 where b.message_id=l_message_id
 and a.intent_id=b.classification_id;
Line: 4934

	select classification_id from iem_email_classifications
	where message_id=l_message_id
	order by score desc;
Line: 4941

   cursor c_item is select ib.item_id,ib.item_name,ib.last_update_date
   from   amv_c_chl_item_match cim,jtf_amv_items_vl ib
   where  cim.channel_category_id = l_cm_cat_id
   and   cim.channel_id is null
   and   cim.approval_status_type ='APPROVED'
   and   cim.table_name_code ='ITEM'
   and   cim.available_for_channel_date <= sysdate
   and   cim.item_id = ib.item_id
   and    nvl(ib.effective_start_date, sysdate) <= sysdate + 1
   and   nvl(ib.expiration_date, sysdate) >= sysdate;
Line: 4974

		select * into l_mail_rec from iem_rt_proc_emails
		where ih_media_item_id=p_media_id and msg_status='AUTOREPLY';
Line: 4978

		l_logmessage:='Error while selecting Message For re-processing '||sqlerrm;
Line: 4984

	select * into l_header_Rec
	from iem_ms_base_headers
	where message_id=l_mail_Rec.message_id;
Line: 4988

	select user_name,email_address
	into l_email_user_name,l_email_address
	from iem_mstemail_accounts
	where email_account_id=l_mail_rec.email_account_id;
Line: 5010

		l_class_val_tbl.delete;
Line: 5079

	l_tag_keyval.delete;
Line: 5136

	select name
	into l_folder_name
	from iem_route_classifications
	where route_classification_id=l_mail_Rec.rt_classification_id;
Line: 5238

		update iem_rt_proc_emails
		set resource_id=0,
		group_id=l_group_id,
		customer_id=p_customer_id,
		contact_id=p_contact_id,
		relationship_id=p_relationship_id,
		msg_status=null,
		mail_proc_status='P',
		category_map_id=l_cm_cat_id
		where message_id=l_mail_rec.message_id;
Line: 5285

								p_action=>'ADD'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			    				 x_out_text=>l_out_text	);
Line: 5300

							-- Update  the Media Life Cycle for Auto Routing
 							 l_media_lc_rec.milcs_id:=l_milcs_id;
Line: 5304

								p_action=>'UPDATE'		,		-- ADD/UPDATE/CLOSE
								p_interaction_rec=>l_interaction_rec,
								p_activity_rec=>l_activity_rec     ,
								p_media_lc_rec=>l_media_lc_Rec ,
								p_media_rec=>l_media_rec	,
								x_id=>l_milcs_id,
								x_status=>l_stat		,
			  				   x_out_text=>l_out_text	);
Line: 5321

				-- In case of autoroute update the interaction with resource id of the agent to which
				-- the message is autorouted to
			l_interaction_rec.interaction_id:=p_interaction_id;
Line: 5325

     		JTF_IH_PUB.Update_Interaction( p_api_version     => 1.1,
                                  p_resp_appl_id    => TO_NUMBER(FND_PROFILE.VALUE('RESP_APPL_ID')),
                                  p_resp_id         => TO_NUMBER(FND_PROFILE.VALUE('RESP_ID')),
                         		p_user_id		  =>nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1),
							p_login_id	  =>TO_NUMBER(FND_PROFILE.VALUE('LOGIN_ID')),
                                  x_return_status   => l_ret_status,
                                  x_msg_count       => l_msg_count,
                                  x_msg_data        => l_msg_data,
                                  p_interaction_rec => l_interaction_rec
                                 );
Line: 5373

		select count(*) into l_kb_rank
		from iem_doc_usage_stats
		where kb_doc_id=v_item.item_id;
Line: 5386

 p_doc_last_modified_date=>v_item.last_update_date,
 			p_score =>l_kb_rank,
 			p_url =>' ',
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_ret_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 5516

cursor c1 is select category_id from iem_account_categories
where email_account_id=l_email_account_id;
Line: 5519

 select keyword,weight from iem_intent_dtls where intent_id=l_classification_id
 and query_response='R';
Line: 5522

 select document_id,KB_REPOSITORY_NAME,score,kb_result_id from iem_kb_results
 where message_id=l_msg_id
 order by 2,1,score asc;
Line: 5526

	select count(*) into l_cnt from iem_kb_results
	where message_id=l_msg_id
	and classification_id=l_classification_id
	and email_account_id=l_email_account_id;
Line: 5556

	select classification_string into l_imt_string
	from IEM_EMAIL_CLASSIFICATIONS
	WHERE MESSAGE_ID=l_msg_id AND EMAIL_ACCOUNT_ID=l_email_account_id
	and classification_id=l_classification_id;
Line: 5583

      p_updated_in_days => l_days,
      p_check_login_user => FND_API.G_FALSE,
      p_application_id => G_APP_ID,
        p_area_array => l_area_array,
        p_content_array => l_content_array,
        p_param_array => l_param_array,
        p_user_id => l_user_id,
        p_category_id => l_category_id,
        p_include_subcats   => FND_API.G_FALSE,
        p_external_contents => FND_API.G_TRUE,
      p_rows_requested_tbl => l_rows_req,
      p_start_row_pos_tbl  => l_start_row,
      p_get_total_cnt_flag => 'T',
      x_rows_returned_tbl => l_rows_returned,
      x_next_row_pos_tbl => l_next_row_pos,
      x_total_row_cnt_tbl => l_total_row_cnt,
      x_result_array  => l_result_array);
Line: 5618

 p_doc_last_modified_date=>l_result_array(l_count).last_update_date,
 			p_score =>to_char(l_result_array(l_count).score),
 			p_url =>l_result_array(l_count).url_string,
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_return_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 5657

      p_updated_in_days => l_days,
      p_check_login_user => FND_API.G_FALSE,
      p_application_id => G_APP_ID,
        p_area_array => l_area_array,
        p_content_array => l_content_array,
        p_param_array => l_param_array,
        p_user_id => l_user_id,
        p_category_id => l_category_id,
        p_include_subcats   => FND_API.G_FALSE,
        p_external_contents => FND_API.G_TRUE,
      p_rows_requested_tbl => l_rows_req,
      p_start_row_pos_tbl  => l_start_row,
      p_get_total_cnt_flag => 'T',
      x_rows_returned_tbl => l_rows_returned,
      x_next_row_pos_tbl => l_next_row_pos,
      x_total_row_cnt_tbl => l_total_row_cnt,
      x_result_array  => l_result_array);
Line: 5692

 p_doc_last_modified_date=>l_result_array(l_count).last_update_date,
 			p_score =>to_char(l_result_array(l_count).score),
 			p_url =>l_result_array(l_count).url_string,
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_return_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 5745

      p_updated_in_days => l_days,
      p_check_login_user => FND_API.G_FALSE,
      p_application_id => G_APP_ID,
        p_area_array => l_area_array,
        p_content_array => l_content_array,
        p_param_array => l_param_array,
        p_user_id => l_user_id,
        p_category_id => l_category_id,
        p_include_subcats   => FND_API.G_TRUE,
        p_external_contents => FND_API.G_TRUE,
      p_rows_requested_tbl => l_rows_req,
      p_start_row_pos_tbl  => l_start_row,
      p_get_total_cnt_flag => 'T',
      x_rows_returned_tbl => l_rows_returned,
      x_next_row_pos_tbl => l_next_row_pos,
      x_total_row_cnt_tbl => l_total_row_cnt,
      x_result_array  => l_result_array);
Line: 5780

 p_doc_last_modified_date=>l_result_array(l_count).last_update_date,
 			p_score =>to_char(l_result_array(l_count).score),
 			p_url =>l_result_array(l_count).url_string,
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_return_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 5819

      p_updated_in_days => l_days,
      p_check_login_user => FND_API.G_FALSE,
      p_application_id => G_APP_ID,
        p_area_array => l_area_array,
        p_content_array => l_content_array,
        p_param_array => l_param_array,
        p_user_id => l_user_id,
        p_category_id => l_category_id,
        p_include_subcats   => FND_API.G_FALSE,
        p_external_contents => FND_API.G_TRUE,
      p_rows_requested_tbl => l_rows_req,
      p_start_row_pos_tbl  => l_start_row,
      p_get_total_cnt_flag => 'T',
      x_rows_returned_tbl => l_rows_returned,
      x_next_row_pos_tbl => l_next_row_pos,
      x_total_row_cnt_tbl => l_total_row_cnt,
      x_result_array  => l_result_array);
Line: 5854

 p_doc_last_modified_date=>l_result_array(l_count).last_update_date,
 			p_score =>to_char(l_result_array(l_count).score),
 			p_url =>l_result_array(l_count).url_string,
			p_kb_delete=>'N',
	p_CREATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_CREATION_DATE  =>SYSDATE,
    	p_LAST_UPDATED_BY  =>TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),
    	p_LAST_UPDATE_DATE  =>SYSDATE,
    	p_LAST_UPDATE_LOGIN=>TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID')) ,
    	p_ATTRIBUTE1   =>null,
    	p_ATTRIBUTE2   =>null,
    	p_ATTRIBUTE3   =>null,
    	p_ATTRIBUTE4   =>null,
    	p_ATTRIBUTE5   =>null,
    	p_ATTRIBUTE6   =>null,
    	p_ATTRIBUTE7   =>null,
    	p_ATTRIBUTE8   =>null,
    	p_ATTRIBUTE9   =>null,
    	p_ATTRIBUTE10  =>null,
    	p_ATTRIBUTE11  =>null,
    	p_ATTRIBUTE12  =>null,
    	p_ATTRIBUTE13  =>null,
    	p_ATTRIBUTE14  =>null,
    	p_ATTRIBUTE15  =>null,
			x_return_status=>l_return_status,
			x_msg_count=>l_msg_count,
			x_msg_data=>l_msg_data);
Line: 5889

 		delete from iem_kb_results where message_id=l_msg_id and kb_result_id=v_doc.kb_result_id;
Line: 6025

    Select parser_id, start_tag, end_tag, column_name, rank
    from iem_parser_dtls
    where parser_id = l_parser_id
    and UPPER(column_name) IN ('ACCOUNT_NUMBER','CUSTOMER_NUMBER','CUSTOMER_NAME',
                               'CUSTOMER_PHONE','CUSTOMER_EMAIL','INSTANCE_NUMBER',
      		  	       'INSTANCE_SERIAL_NUMBER','INCIDENT_SITE_NUMBER','CONTACT_NUMBER',
                               'CONTACT_NAME','CONTACT_PHONE','CONTACT_EMAIL')
    order by rank asc;
Line: 6037

    Select parser_id, start_tag, end_tag, column_name, rank
    from iem_parser_dtls
    where parser_id = l_parser_id
    and UPPER(column_name) IN ('ADDRESSEE', 'EXTERNAL_REFERENCE', 'INCIDENT_ADDRESS1', 'INCIDENT_ADDRESS2',
                               'INCIDENT_ADDRESS3', 'INCIDENT_ADDRESS4', 'INCIDENT_CITY', 'INCIDENT_COUNTRY',
                               'INCIDENT_COUNTY', 'INCIDENT_POSTAL_CODE', 'INCIDENT_PROVINCE', 'INCIDENT_STATE',
                               'PROBLEM_CODE',  'SERVICE_REQUEST_TYPE', 'SITE_NAME', 'URGENCY', 'INVENTORY_ITEM_NAME')
    order by rank asc;
Line: 6048

   SELECT party_type
   FROM  hz_parties a
   WHERE a.party_id = g_customer_id
   AND	a.status = 'A'
   AND   a.party_type IN ('ORGANIZATION','PERSON');
Line: 6148

         FOR contact_rec in (Select start_tag, end_tag, column_name, rank
                                 from iem_parser_dtls
                                 where parser_id = p_parser_id
                                 and UPPER(column_name) IN ('CONTACT_PHONE','CONTACT_EMAIL')
                                 order by rank asc)
         LOOP
             IF (contact_rec.column_name = 'CONTACT_PHONE') THEN
                      BEGIN
                          l_contact_phone:= get_tag_data(contact_rec.start_tag, contact_rec.end_tag, p_message_id);
Line: 6158

                          Select a.person_id, b.phone_id,  'PHONE','EMPLOYEE'
	                  into g_contact_party_id,g_contact_point_id, g_contact_point_type, g_contact_party_type
	                  from  per_workforce_x a,per_phones b
 			  where a.person_id = b.parent_id
	                  and REGEXP_REPLACE(b.phone_number,'([[:punct:]|[:space:]]*)') = l_contact_phone;
Line: 6185

                          Select a.person_id, 'EMAIL','EMPLOYEE'
	                  into g_contact_party_id, g_contact_point_type , g_contact_party_type
	                  from per_workforce_current_x a
	                  where UPPER(a.email_Address) = upper(l_contact_email);
Line: 6631

           select party_type into g_contact_party_type
           from hz_parties
           where party_id = p_contact_id
           and rownum = 1;
Line: 6891

	     select cust_account_id into l_cust_account_id
	     from hz_cust_accounts
	     where party_id =g_customer_id;
Line: 6958

           SELECT distinct --c.concatenated_segments,
                --cs.category_set_name,
                --cs.description cat_set_description,
                --t.description cat_description,
                c.category_id  into l_category_Id
               -- ic.category_set_id  --Category_Set_Id
           FROM mtl_category_set_valid_cats ic,
           mtl_categories_kfv c,
           mtl_category_sets_vl cs,
             mtl_item_categories itc,
           mtl_categories_tl t
           WHERE ic.category_id = c.category_id
           AND t.category_id (+) = c.category_id
           AND t.language (+) = userenv('LANG')
           AND ic.category_set_id = cs.category_set_id
           AND ic.category_set_id =  fnd_profile.value('CS_SR_DEFAULT_CATEGORY_SET')
           AND itc.inventory_item_id = l_inventory_item_id
           AND itc.category_id = c.category_id
           AND itc.category_set_id = ic.category_set_id
           AND itc.organization_id = cs_std.Get_Item_Valdn_Orgzn_Id
           AND sysdate <= NVL(c.disable_date,sysdate);
Line: 7189

     l_logmessage:='INSERTED REQUEST ID  : ' || l_sr_create_out_rec.request_id ;
Line: 7193

     l_logmessage:='INSERTED REQUEST NUM : ' || l_sr_create_out_rec.request_number;
Line: 7296

	   select party_id into x_customer_id
           from hz_parties where party_number = p_customer_number;
Line: 7319

	     select party_id into x_customer_id
	     from hz_parties where UPPER(party_name) = UPPER(p_customer_name);
Line: 7339

	     select party_id into x_customer_id
	     from hz_cust_accounts
	     where account_number=p_account_number;
Line: 7361

	    Select owner_table_id into x_customer_id
	    From hz_contact_points
	    where owner_table_name='HZ_PARTIES'
	    and contact_point_type = 'PHONE'
	    and phone_number =p_customer_phone;
Line: 7367

	    Select owner_table_id into x_customer_id
            from hz_contact_points a, hz_parties b
            where a.owner_table_name='HZ_PARTIES'
            and a.contact_point_type='PHONE'
            and a.status='A'
            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
    					 	 	  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	    and a.owner_table_id = b.party_id
  	    and b.party_type in ('PERSON', 'ORGANIZATION')
            and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_customer_phone,'([[:punct:]|[:space:]]*)');
Line: 7397

	    Select owner_table_id into x_customer_id
	    From hz_contact_points
	    where owner_table_name='HZ_PARTIES'
	    and contact_point_type = 'EMAIL'
	    and upper(email_address) =upper(p_customer_email);
Line: 7406

             Select a.owner_table_id into x_customer_id
            from hz_contact_points a, hz_parties b
            where a.owner_table_name='HZ_PARTIES'
	    and a.contact_point_type = 'EMAIL'
            and a.status='A'
            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
    					 	 	  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	    and a.owner_table_id = b.party_id
  	    and b.party_type in ('PERSON', 'ORGANIZATION')
	    and upper(a.email_address) =upper(p_customer_email);
Line: 7439

            select distinct owner_party_id
            into x_customer_id
            from csi_item_instances
	    where instance_number = p_instance_number;
Line: 7463

            select distinct owner_party_id
            into x_customer_id
            from csi_item_instances
	    where serial_number = p_instance_serial_number;
Line: 7485

             select party_id into x_customer_id
             from hz_party_sites
             where party_site_number = p_incident_site_number;
Line: 7517

              Select distinct b.subject_id
              into g_customer_id
	      from hz_contact_points a,hz_relationships b, hz_parties c
              where a.owner_table_name='HZ_PARTIES'
              and a.status='A'
	      and a.primary_flag = 'Y'
              and a.owner_table_id = b.party_id
	      and directional_flag = 'B'
              and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	  	                              where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	      and b.object_id = c.party_id
	      and c.party_number = p_contact_number;
Line: 7530

             select upper(party_type) into l_party_type
             from hz_parties
             where party_number = p_contact_number;
Line: 7539

                 select distinct a.subject_id
                 into g_customer_id
  	         from hz_relationships a, hz_parties b
	         where a.party_id = b.party_id
                 and directional_flag = 'B'
                 and b.party_number = p_contact_number;
Line: 7550

                 select distinct a.subject_id
                 into g_customer_id
          	 from hz_relationships a, hz_parties b
	         where a.object_id = b.party_id
                 and directional_flag = 'B'
                 and b.party_number = p_contact_number;
Line: 7561

                 select party_id into g_customer_id
                 from hz_parties
                 where party_number = p_contact_number;
Line: 7589

             select distinct a.subject_id
             into g_customer_id
  	     from hz_relationships a, hz_parties b
	     where a.object_id = b.party_id
             and directional_flag = 'B'
             and upper(b.party_name) = upper(p_contact_name);
Line: 7617

             select distinct b.object_id into g_customer_id
             from hz_parties a, hz_party_relationships b, hz_contact_points c
             where  c.phone_number = p_contact_phone
             where and reverse(c.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)')
             and a.party_id = b.subject_id
             and c.owner_table_id = b.party_id
             and c.contact_point_type = 'PHONE'
             and c.owner_table_name = 'HZ_PARTIES';
Line: 7626

             Select distinct b.subject_id into g_customer_id
	     from hz_contact_points a,hz_relationships b, hz_parties c
             where a.owner_table_name='HZ_PARTIES'
	     and  a.contact_point_type='PHONE'
             and a.status='A'
	     and a.primary_flag = 'Y'
             and a.owner_table_id = b.party_id
	     and directional_flag = 'B'
             and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	  	                              where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	     and b.object_id = c.party_id
	     and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)');
Line: 7659

             select distinct b.object_id into g_customer_id
             from hz_parties a, hz_party_relationships b, hz_contact_points c
	     where upper(c.email_address) =upper(p_contact_email)
             and a.party_id = b.subject_id
             and c.owner_table_id = b.party_id
             and c.contact_point_type = 'EMAIL'
             and c.owner_table_name = 'HZ_PARTIES';
Line: 7667

             Select distinct b.subject_id into g_customer_id
	     from hz_contact_points a,hz_relationships b, hz_parties c
             where a.owner_table_name='HZ_PARTIES'
	     and  a.contact_point_type='EMAIL'
             and a.status='A'
	     and a.primary_flag = 'Y'
             and a.owner_table_id = b.party_id
	     and directional_flag = 'B'
             and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	  	                              where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	     and b.object_id = c.party_id
	     and upper(a.email_address) =upper(p_contact_email);
Line: 7730

	  Select cust_account_id into x_cust_account_id
	  from hz_cust_accounts
	  where party_id=g_customer_id
	  and account_number=p_account_number
          and status = 'A';
Line: 7753

	  Select cust_account_id into x_cust_account_id
	  from hz_cust_accounts
	  where account_number=p_account_number
          and status = 'A';
Line: 7806

            Select contact_point_id into x_customer_phone_id
            From hz_contact_points
            where contact_point_type = 'PHONE'
            --and phone_number = p_customer_phone
            and reverse(transposed_phone_number)=REGEXP_REPLACE(p_customer_phone,'([[:punct:]|[:space:]]*)')
            and owner_table_id = g_customer_id;
Line: 7829

           Select contact_point_id into x_customer_phone_id
            From hz_contact_points
            where owner_table_name='HZ_PARTIES'
            and contact_point_type = 'PHONE'
            and reverse(transposed_phone_number)=REGEXP_REPLACE(p_customer_phone,'([[:punct:]|[:space:]]*)');
Line: 7869

            Select contact_point_id into x_customer_email_id
            From hz_contact_points
            where contact_point_type = 'EMAIL'
            and upper(email_address) =upper(p_customer_email)
            and owner_table_id = g_customer_id;
Line: 7892

             Select contact_point_id into x_customer_email_id
             From hz_contact_points
             where owner_table_name='HZ_PARTIES'
             and contact_point_type = 'EMAIL'
             and upper(email_address) =upper(p_customer_email);
Line: 7959

                  select instance_id,inventory_item_id, inv_master_organization_id
                  into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                  from csi_item_instances
                  where instance_number = p_instance_number
                  and owner_party_account_id = p_cust_account_id
                  and owner_party_id = g_customer_id;
Line: 7984

                  select instance_id,inventory_item_id, inv_master_organization_id
                  into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                  from csi_item_instances
                  where instance_number = p_instance_number
                  and owner_party_id = g_customer_id;
Line: 8010

                select instance_id,inventory_item_id, inv_master_organization_id
                into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                from csi_item_instances
                where instance_number = p_instance_number
                and owner_party_account_id = p_cust_account_id;
Line: 8034

              select instance_id,inventory_item_id, inv_master_organization_id
              into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
              from csi_item_instances
              where instance_number = p_instance_number;
Line: 8108

                   select instance_id,inventory_item_id,inv_master_organization_id
                   into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                   from csi_item_instances
                   where serial_number = p_instance_serial_number
                   and owner_party_account_id = p_cust_account_id
                   and owner_party_id = g_customer_id;
Line: 8137

                  select instance_id,inventory_item_id,inv_master_organization_id
                  into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                  from csi_item_instances
                  where serial_number = p_instance_serial_number
                  and owner_party_id = g_customer_id;
Line: 8171

                select instance_id,inventory_item_id, inv_master_organization_id
                into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
                from csi_item_instances
                where serial_number = p_instance_serial_number
                and owner_party_account_id = p_cust_account_id;
Line: 8202

               select instance_id,inventory_item_id, inv_master_organization_id
               into x_customer_product_id, x_inventory_item_id, x_inventory_org_id
               from csi_item_instances
                where serial_number = p_instance_serial_number;
Line: 8249

            select party_site_id into x_incident_location_id
            from hz_party_sites
            where party_site_number = p_incident_site_number
            and party_id = g_customer_id;
Line: 8270

          select party_site_id into x_incident_location_id
          from hz_party_sites
          where party_site_number = p_incident_site_number;
Line: 8325

             select upper(party_type) into l_party_type
             from hz_parties
             where party_number = p_contact_number;
Line: 8333

             FOR contact_rec in (Select column_name, rank
                                 from iem_parser_dtls
                                 where parser_id = p_parser_id
                                 and UPPER(column_name) IN ('CONTACT_PHONE','CONTACT_EMAIL')
                                 order by rank asc)
             LOOP
                --only go throug the processing if the value has not been found
                --in the last itiration there fore checking the x_contact_party_id value
                --we are also looking for contact_phone and contact_email because its very rare to get a
                --single hit from just from the contact_number.
                IF x_contact_party_id IS NULL THEN

                   IF ((contact_rec.column_name = 'CONTACT_PHONE') AND (p_contact_phone is not null)) THEN
                      BEGIN
                        IF (l_party_type = 'PERSON') THEN
                            l_logmessage:='contact_number->contact_phone->type:person processing';
Line: 8354

                            Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		            into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                            from hz_contact_points a,hz_relationships b, hz_parties c
                            where a.owner_table_name='HZ_PARTIES'
                            and  a.contact_point_type='PHONE'
                            and a.status='A'
                            and a.owner_table_id = b.party_id
                            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					    where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                    and b.party_id = c.party_id
                            and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                            --and c.party_number =p_contact_number
                            and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)')
	                    and b.subject_id = g_customer_id;
Line: 8373

                            Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		            into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                            from hz_contact_points a,hz_relationships b, hz_parties c
                            where a.owner_table_name='HZ_PARTIES'
                            and  a.contact_point_type='PHONE'
                            and a.status='A'
                            and a.owner_table_id = b.party_id
                            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					    where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                    and b.party_id = c.party_id
                            --and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                            and c.party_number =p_contact_number
                            and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)')
	                    and b.subject_id = g_customer_id;
Line: 8416

                            Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		            into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                            from hz_contact_points a,hz_relationships b, hz_parties c
                            where a.owner_table_name='HZ_PARTIES'
                            and a.contact_point_type = 'EMAIL'
                            and a.status='A'
                            and a.owner_table_id = b.party_id
                            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					    where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                    and b.party_id = c.party_id
                            and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                            --and c.party_number =p_contact_number
                            and upper(c.email_address) = upper(p_contact_email)
	                    and b.subject_id = g_customer_id;
Line: 8435

                            Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		            into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                            from hz_contact_points a,hz_relationships b, hz_parties c
                            where a.owner_table_name='HZ_PARTIES'
                            and a.contact_point_type = 'EMAIL'
                            and a.status='A'
                            and a.owner_table_id = b.party_id
                            and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					    where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                    and b.party_id = c.party_id
                            --and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                            and c.party_number =p_contact_number
                            and upper(c.email_address) = upper(p_contact_email)
	                    and b.subject_id = g_customer_id;
Line: 8488

                      Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		      into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                      from hz_contact_points a,hz_relationships b, hz_parties c
                      where a.owner_table_name='HZ_PARTIES'
                      and a.status='A'
                      and a.primary_flag = 'Y'
                      and a.owner_table_id = b.party_id
                      and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 			  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	               and b.party_id = c.party_id
                       and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                      -- and c.party_number =p_contact_number
	               and b.subject_id = g_customer_id
                       and rownum = 1;
Line: 8506

                      Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		      into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                      from hz_contact_points a,hz_relationships b, hz_parties c
                      where a.owner_table_name='HZ_PARTIES'
                      and a.status='A'
                      and a.primary_flag = 'Y'
                      and a.owner_table_id = b.party_id
                      and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 			  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	               and b.party_id = c.party_id
                       --and b.object_id in (select party_id from hz_parties where party_number = p_contact_number)
                       and c.party_number =p_contact_number
	               and b.subject_id = g_customer_id
                       and rownum = 1;
Line: 8564

             FOR contact_rec in (Select column_name, rank
                                 from iem_parser_dtls
                                 where parser_id = p_parser_id
                                 and UPPER(column_name) IN ('CONTACT_PHONE','CONTACT_EMAIL')
                                 order by rank asc)
             LOOP
                --only go throug the processing if the value has not been found
                --in the last itiration there fore checking the x_contact_party_id value
                IF (x_contact_party_id) IS NULL THEN
                   IF (contact_rec.column_name = 'CONTACT_PHONE') THEN
                      BEGIN
                          Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		          into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                          from hz_contact_points a,hz_relationships b, hz_parties c
                          where a.owner_table_name='HZ_PARTIES'
                          and  a.contact_point_type='PHONE'
                          and a.status='A'
                          and a.owner_table_id = b.party_id
                          and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                  and b.party_id = c.party_id
                          and b.object_id in (select party_id from hz_parties where upper(party_name) =upper(p_contact_name))
                          --and upper(c.party_name) =upper(p_contact_name)
                          and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)')
	                  and b.subject_id = g_customer_id;
Line: 8614

                          Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		          into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                          from hz_contact_points a,hz_relationships b, hz_parties c
                          where a.owner_table_name='HZ_PARTIES'
                          and a.contact_point_type = 'EMAIL'
                          and a.status='A'
                          and a.owner_table_id = b.party_id
                          and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	                  and b.party_id = c.party_id
                         -- and upper(c.party_name) =upper(p_contact_name)
                          and b.object_id in (select party_id from hz_parties where upper(party_name) =upper(p_contact_name))
                          and upper(c.email_address) = upper(p_contact_email)
	                  and b.subject_id = g_customer_id;
Line: 8659

                      Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		      into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                      from hz_contact_points a,hz_relationships b, hz_parties c
                      where a.owner_table_name='HZ_PARTIES'
                      and a.status='A'
                      and a.primary_flag = 'Y'
                      and a.owner_table_id = b.party_id
                      and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 			  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	               and b.party_id = c.party_id
                       and b.object_id in (select party_id from hz_parties where upper(party_name) =upper(p_contact_name))
                       --and upper(c.party_name) =upper(p_contact_name)
	               and b.subject_id = g_customer_id;
Line: 8718

                  Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		  into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                  from hz_contact_points a,hz_relationships b, hz_parties c
                  where a.owner_table_name='HZ_PARTIES'
                  and  a.contact_point_type='PHONE'
                  and a.status='A'
                  and a.owner_table_id = b.party_id
                  and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	          and b.party_id = c.party_id
                  and reverse(a.transposed_phone_number)=REGEXP_REPLACE(p_contact_phone,'([[:punct:]|[:space:]]*)')
	          and b.subject_id = g_customer_id;
Line: 8764

                  Select c.party_id, c.party_type,  a.contact_point_id, a.contact_point_type
		  into x_contact_party_id, x_contact_type, x_contact_point_id, x_contact_point_type
                  from hz_contact_points a,hz_relationships b, hz_parties c
                  where a.owner_table_name='HZ_PARTIES'
                  and  a.contact_point_type='EMAIL'
                  and a.status='A'
                  and a.owner_table_id = b.party_id
                  and a.contact_point_id not in  (select contact_level_table_id from HZ_CONTACT_PREFERENCES
     	 					  where contact_level_table='HZ_CONTACT_POINTS' and status='A')
	          and b.party_id = c.party_id
                  and upper(a.email_address)=upper(p_contact_email)
	          and b.subject_id = g_customer_id;
Line: 8808

       select DISTINCT inventory_item_id, organization_id
       into x_inventory_item_id, x_inventory_org_id
       from mtl_system_items_b
       where organization_id=FND_PROFILE.value('CS_INV_VALIDATION_ORG') and
       upper(segment1)= upper(p_inventory_item_name);
Line: 8882

     select count(problem_code) into l_code_count
     from cs_sr_prob_code_mapping_detail
     where problem_code = p_problem_code;
Line: 8941

          select party_site_id into x_party_site_id
          from hz_party_sites
          where upper(party_site_name) = upper(p_site_name)
          and party_id = g_customer_id;
Line: 8981

        select count(external_reference) into l_ext_ref_count
        from   csi_item_instances
        where  upper(external_reference) = upper(p_ext_ref);
Line: 9031

        select cust_account_id into x_account_id
        from   hz_cust_accounts
        where    party_id = p_customer_id
        AND   status = 'A';
Line: 9061

        SELECT s.party_site_id into x_bill_to_site_id
             FROM hz_party_sites s,
               hz_parties p,
               hz_locations l,
               hz_party_site_uses u
             WHERE p.party_id = p_customer_id
              AND p.party_id = s.party_id
              AND s.status = 'A'
              AND s.location_id = l.location_id
              AND s.party_site_id = u.party_site_id
              AND u.site_use_type = 'BILL_TO'
              AND u.primary_per_type = 'Y'
              AND u.status = 'A';
Line: 9099

      SELECT s.party_site_id into x_ship_to_site_id
             FROM hz_party_sites s,
               hz_parties p,
               hz_locations l,
               hz_party_site_uses u
             WHERE p.party_id = p_customer_id
              AND p.party_id = s.party_id
              AND s.status = 'A'
              AND s.location_id = l.location_id
              AND s.party_site_id = u.party_site_id
              AND u.site_use_type = 'SHIP_TO'
              AND u.primary_per_type = 'Y'
              AND u.status = 'A';
Line: 9164

    select upper(value) email
    from IEM_MS_MSGBODYS
    where message_id = l_message_id
    order by order_id asc;