DBA Data[Home] [Help]

APPS.IEM_MIGRATION_PVT SQL Statements

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

Line: 14

cursor c_account is select email_account_id,email_user,domain,EMAIL_PASSWORD,db_link from
iem_email_accounts a,iem_db_connections b
where a.db_server_id=b.db_server_id
and b.is_admin='A'
and upper(a.email_user)<>'INTENT';
Line: 21

select name||','||a.route_classification_id name from iem_route_classifications a,iem_account_route_class b
where a.route_classification_id=b.route_classification_id
and b.email_account_id=l_email_account_id
union
select 'Inbox' from dual
union
select 'Drafts' from dual
union
select 'Resolved' from dual
union
select 'Sent' from dual
union
select 'Deleted' from dual
union
select 'Admin' from dual
union
select 'Retry' from dual;
Line: 51

cursor c_agent is select agent_account_id,resource_id from iem_agent_accounts
where email_account_id= l_email_account_id;
Line: 54

     l_LAST_UPDATED_BY    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('USER_ID')) ;
Line: 55

     l_LAST_UPDATE_LOGIN    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ ID')) ;
Line: 86

	'select arch_folder_name from iem_Archived_Folders where
	email_account_id=:id ' using l_email_account_id;
Line: 105

	 IF (upper(v1.email_user)='ACKNOWLEDGEMENTS') and x_folder_tbl(i) in ('Resolved','Deleted','Admin','Retry') then
	 	l_ack_flag:=1;
Line: 119

				select count(*) into l_total_count
				from iem_post_mdts where email_account_id=l_email_account_id and agent_id=v3.resource_id ;
Line: 123

				select count(a.rt_media_item_id)
	   			into l_total_count
           		from iem_rt_media_items a, iem_msg_parts part
           		where a.rt_interaction_id in (select rtm.rt_interaction_id
           		from iem_rt_media_items rtm, iem_rt_interactions rti
           		where rtm.message_id in (select message_id from iem_post_mdts
          		 where email_account_id = l_email_account_id  and agent_id = v3.resource_id)
           		and rtm.email_type ='I' and rtm.rt_interaction_id = rti.rt_interaction_id
           		and rti.expire = 'N') and a.email_type = 'O' and a.folder_uid > 0
           		and a.folder_name = 'Drafts' and part.ref_key = a.rt_media_item_id
           		and part.part_type = 'HEADERS' and part.delete_flag <> 'Y';
Line: 135

				select IEM_MIGRATION_DETAILS_S1.nextval into l_mig_id from dual;
Line: 136

				insert into IEM_MIGRATION_DETAILS
				(migration_id,
				agent_account_id,
				email_account_id,
				folder_name,
				folder_type,
				total_msg_count,
				status,
				status_text,
				CREATED_BY          ,
				CREATION_DATE       ,
				LAST_UPDATED_BY     ,
				LAST_UPDATE_DATE    ,
				LAST_UPDATE_LOGIN   )

				values

				(l_mig_id,v3.agent_Account_id,l_email_account_id,l_folder_name,l_folder_type,l_total_count,
				l_status,l_status_text,l_created_by,sysdate,l_last_updated_by,sysdate,l_last_update_login);
Line: 157

			if ((x_folder_tbl(i) in  ('Resolved','Sent','Deleted','Admin','Retry'))
			OR (x_folder_tbl(i) like 'Arch%')) then
				l_folder_name:=x_folder_tbl(i);
Line: 172

        G_MSG_TABLE.DELETE;
Line: 196

			select count(*) into l_total_count
			from iem_post_mdts where email_account_id=l_email_account_id
			and rt_classification_id=l_class_id and agent_id=0;
Line: 202

				select IEM_MIGRATION_DETAILS_S1.nextval into l_mig_id from dual;
Line: 203

				insert into IEM_MIGRATION_DETAILS
				(migration_id,
				email_account_id,
				folder_name,
				folder_type,
				total_msg_count,
				status,
				status_text,
				CREATED_BY          ,
				CREATION_DATE       ,
				LAST_UPDATED_BY     ,
				LAST_UPDATE_DATE    ,
				LAST_UPDATE_LOGIN   )

		values

		(l_mig_id,l_email_account_id,l_folder_name,l_folder_type,l_total_count,l_status,l_status_text,l_created_by,
		sysdate,l_last_updated_by,sysdate,l_last_update_login);
Line: 236

cursor c1 is select * from iem_migration_store_temp
where migration_id=p_migration_id and mig_status='R' and dp_status='D';
Line: 244

 l_LAST_UPDATED_BY    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('USER_ID')) ;
Line: 245

 l_LAST_UPDATE_LOGIN    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ ID')) ;
Line: 267

select folder_type into l_folder_type from iem_migration_details
where migration_id=p_migration_id;
Line: 275

	elsif  upper(v1.folder_name) like '%DELETE%' then
		l_proc_status:='D';
Line: 292

        select media_id, creation_date INTO l_media_id, l_received_date
			   from jtf_ih_media_items
         where media_item_type = 'EMAIL'
         AND  media_item_ref=v1.rfc822_message_id
         AND source_id=v1.email_account_id
         and rownum = 1;
Line: 299

      UPDATE iem_migration_store_temp
      set  ih_media_item_id = l_media_id
      WHERE mail_id = v1.mail_id
      AND ih_media_item_id IS NULL;
Line: 305

      l_error_text:='Error duing selecting media_id and date- l_media_id:'|| l_media_id ||' l_received_Date:'|| l_received_Date;
Line: 315

	   select creation_date into l_received_Date from jtf_ih_media_items
	    where media_id=l_media_id;
Line: 320

      l_error_text:='Error duing selecting date- l_media_id:'|| l_media_id ||' l_received_Date:'|| l_received_Date;
Line: 327

	select iem_ms_base_headers_s1.nextval into l_message_id from dual;
Line: 329

	insert into iem_arch_msgdtls
    (MESSAGE_ID   ,
 	EMAIL_ACCOUNT_ID  ,
 	MAILPROC_STATUS ,
 	MAIL_TYPE,
 	FROM_STR,
 	REPLY_TO_STR,
 	TO_STR,
 	CC_STR,
 	BCC_STR,
 	SENT_DATE,
 	RECEIVED_DATE ,
 	SUBJECT,
 	RESOURCE_ID ,
 	MESSAGE_SIZE ,
 	IH_MEDIA_ITEM_ID,
 	CUSTOMER_ID,
 	CONTACT_ID,
 	RELATIONSHIP_ID ,
 	MESSAGE_TEXT,
 	CREATED_BY,
 	CREATION_DATE,
 	LAST_UPDATED_BY,
 	LAST_UPDATE_DATE ,
 	LAST_UPDATE_LOGIN)
values
       ( 	l_message_id,
          v1.email_account_id,
          l_proc_status,
          l_mail_type,
          v1.from_str,
          v1.reply_to_str,
          v1.to_str,
          v1.cc_str,
          v1.bcc_str,
          v1.sent_date,
          l_received_date,
          v1.subject,
          l_resource_id,
          v1.message_size,
	  l_media_id,
	   l_party_id,
          l_contact_id,
          l_relationship_id,
          v1.message_text,
		nvl(l_created_by,-1),
		sysdate,
		nvl(l_last_updated_by,-1),
		sysdate,
		l_last_update_login);
Line: 380

	-- Insert into IEM_ARCH_MESSAGES
	insert into iem_arch_msgs
	(MESSAGE_ID,
 	MESSAGE_CONTENT,
 	CREATED_BY,
 	CREATION_DATE,
 	LAST_UPDATED_BY,
 	LAST_UPDATE_DATE,
 	LAST_UPDATE_LOGIN)
	(select decode(message_id,message_id,l_message_id),message_content,CREATED_BY,CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN from
	iem_migration_Store_temp where migration_id=p_migration_id and message_id=v1.message_id);
Line: 392

	-- Update Media Items with new message Id
  /* commented by siahmed
	update jtf_ih_media_items
	set media_item_ref=l_message_id
	where media_id=v1.ih_media_item_id;
Line: 400

	update jtf_ih_media_items
	set media_item_ref=l_message_id
	where media_id=l_media_id;
Line: 404

			update iem_migration_store_temp
			set mig_Status='M'
			where migration_id=p_migration_id and message_id=v1.message_id;
Line: 425

			  delete from iem_arch_msgs where message_id=l_message_id;
Line: 426

			  delete from iem_arch_msgdtls where message_id=l_message_id;
Line: 428

      l_error_text:=l_error_text ||'-Other exception during delete sqlerrm:'||sqlerrm;
Line: 432

			  update iem_migration_store_temp
			  set mig_Status='E',
			  error_text=l_error_text
			  where migration_id=p_migration_id and  message_id=v1.message_id;
Line: 437

       l_error_text:=l_error_text ||'-Other exception during update sqlerrm:'||sqlerrm;
Line: 452

		select * into l_post_rec from iem_post_mdts
		where message_id=v1.message_id;
Line: 490

				-- Update Message Flag
				begin
				if l_post_rec.message_flag is not null then
					update iem_Rt_proc_emails
					set message_flag=l_post_rec.message_flag
					where message_id=l_post_rec.message_id;
Line: 500

	-- Update Media Items with new message Id

	update jtf_ih_media_items
	set media_item_ref=v1.message_id
	where media_id=v1.ih_media_item_id;
Line: 505

	-- update MIG status to "M"
			update iem_migration_store_temp
			set mig_Status='M'
			where migration_id=p_migration_id and message_id=v1.message_id;
Line: 514

			update iem_migration_Store_temp
			set mig_Status=l_mig_status,
			error_text=l_error_text
			where migration_id=p_migration_id and message_id=v1.message_id;
Line: 521

 		update iem_migration_details
		set folder_status='M'
		where migration_id=p_migration_id;
Line: 526

 		update iem_migration_details
		set folder_status='M',
		status='E',
		STATUS_TEXT='Error Encountered During Post Processing '
		where migration_id=p_migration_id;
Line: 543

 select a.* from iem_post_mdts a,iem_route_classifications b
 where a.email_account_id=l_email_account_id and a.agent_id=0
 and a.rt_classification_id=b.route_classification_id and
 b.name=l_folder_name and a.message_id not in (select message_id from iem_migration_store_temp
 where migration_id=p_migration_id)
 union			-- select records which are also errors out
 select a.* from iem_post_mdts a,iem_route_classifications b
 where a.email_account_id=l_email_account_id and a.agent_id=0
 and a.rt_classification_id=b.route_classification_id and
 b.name=l_folder_name and a.message_id in (select message_id from iem_migration_store_temp
 where migration_id=p_migration_id and mig_status='E' and dp_status is null);
Line: 570

 l_LAST_UPDATED_BY    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('USER_ID')) ;
Line: 571

 l_LAST_UPDATE_LOGIN    NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ ID')) ;
Line: 577

 INSERT_ERROR		EXCEPTION;
Line: 582

	select message_id from iem_migration_store_temp
	where migration_id=p_migration_id and
	(mig_status='E' and DP_STATUS is null);
Line: 586

	select message_id from iem_migration_store_temp
	where migration_id=p_migration_id and
	(mig_status='E' and  DP_STATUS is null);
Line: 607

		select mail_id,folder_name,email_account_id from iem_migration_store_temp
		where migration_id=p_migration_id and substr(folder_name,1,1)<>'I';
Line: 611

select email_account_id,folder_name,folder_type,agent_Account_id,total_msg_count into
l_email_account_id,l_folder_name,l_folder_type,l_agent_account_id,l_total_msg_count
from iem_migration_details
where migration_id=p_migration_id;
Line: 624

		select a.db_link into l_dblink
         from iem_db_connections a, iem_email_accounts b
         where a.db_server_id=b.db_Server_id
           and b.email_account_id = l_email_account_id and a.is_admin='A';
Line: 629

		select count(*) into l_qcount from iem_migration_store_temp
		where migration_id=p_migration_id;
Line: 632

			delete from iem_migration_store_temp
			where migration_id=p_migration_id and mig_status=null;
Line: 642

         execute immediate 'select reply_to, cc_str, bcc_str from '
           ||'OM_HEADER@'||l_dblink||' where msg_id = :b1'
		into l_mig_rec.reply_to_str,l_mig_rec.cc_str, l_mig_rec.bcc_str using l_source_message_id;
Line: 660

		select IEM_MIGRATION_STORE_TEMP_s1.nextval into l_mig_rec.mail_id from dual;
Line: 661

	insert into iem_migration_store_temp
	(MAIL_ID,
 	MESSAGE_ID ,
	MIGRATION_ID,
 	MESSAGE_TYPE ,
 	EMAIL_ACCOUNT_ID ,
     AGENT_ACCOUNT_ID  ,
 	RESOURCE_ID       ,
 	FOLDER_NAME       ,
 	RT_MEDIA_ITEM_ID  ,
 	MSG_UID          ,
 	RFC822_MESSAGE_ID ,
 	FROM_STR       ,
 	TO_STR          ,
 	REPLY_TO_STR   ,
 	CC_STR         ,
 	BCC_STR          ,
 	SENT_DATE        ,
 	SUBJECT          ,
 	IH_MEDIA_ITEM_ID ,
 	MESSAGE_SIZE     ,
 	DP_STATUS        ,
 	MIG_STATUS       ,
 	ERROR_TEXT,
	CREATED_BY          ,
	CREATION_DATE       ,
	LAST_UPDATED_BY     ,
	LAST_UPDATE_DATE    ,
	LAST_UPDATE_LOGIN   )

 VALUES
 	(l_mig_rec.mail_id,
 	l_mig_rec.message_id,
	p_migration_id,
	l_folder_type,
 	l_email_account_id,
 	l_mig_rec.agent_account_id,
 	l_mig_rec.resource_id,
	l_folder_name,
	null,
 	l_mig_rec.msg_uid,
 	l_mig_rec.RFC822_MESSAGE_ID,
 	l_mig_rec.from_Str,
 	l_mig_rec.to_str,
 	l_mig_rec.reply_to_str,
 	l_mig_rec.cc_str,
 	l_mig_rec.bcc_Str,
 	l_mig_rec.sent_Date,
	l_mig_rec.subject,
	l_mig_rec.ih_media_item_id,
	l_mig_rec.MESSAGE_SIZE,
	null,
     l_mig_status,
	l_error_text,
	l_created_by,
	sysdate,
	l_last_updated_by,
	sysdate,
	l_last_update_login);
Line: 721

	select count(*) into l_rec_counter from iem_migration_Store_temp
	where migration_id=p_migration_id ;
Line: 723

		update iem_migration_details
		set MSG_RECORD_COUNT=l_rec_counter
		where migration_id=p_migration_id;
Line: 729

		update iem_migration_details
		set folder_status='R',
		status='S'
		where migration_id=p_migration_id;
Line: 738

		select migration_id into l_inb_migration_id from iem_migration_details
		where email_account_id=l_email_Account_id and agent_account_id=l_agent_account_id
		and folder_name='Inbox';
Line: 745

	select count(*) into l_ag_count from iem_migration_store_temp where migration_id=p_migration_id;
Line: 769

		select count(*) into l_disc_count from iem_migration_Store_temp
		where migration_id=p_migration_id and substr(folder_name,1,1) not in ('I');
Line: 773

			select migration_id into l_mig_id from iem_migration_details
			where email_account_id=v1.email_account_id and folder_name=v1.folder_name;
Line: 775

			update iem_migration_store_temp
			set message_type='Q',
			migration_id=l_mig_id
			where mail_id=v1.mail_id;
Line: 779

			-- Update Count of Migration after pushing these inbox message into Queue Count
			update iem_migration_details
			set total_msg_count=nvl(total_msg_count,0)+1,
			msg_record_count=nvl(msg_record_count,0)+1
			where migration_id=l_mig_id;
Line: 787

		select count(*) into l_rec_counter from iem_migration_store_temp
		where migration_id=p_migration_id ;
Line: 790

		select count(*) into l_error_counter from iem_migration_store_temp
		where migration_id=p_migration_id and mig_status='E' and dp_status is null;
Line: 792

			update iem_migration_details
			set MSG_RECORD_COUNT=l_rec_counter-l_error_counter,
			total_msg_count=l_rec_counter,
			folder_status='R'
			where migration_id=p_migration_id;
Line: 798

	update iem_migration_details
		set folder_Status='R',
		status='E',
		status_text='Error While Creating Worklist Items'
		where  migration_id=p_migration_id;
Line: 807

	select to_date(value,'YYYY/MM/DD HH24:MI:SS') into l_hist_date from
	iem_comp_rt_Stats where  type='HISTORICAL' and param='LASTRUN' ;
Line: 809

		select a.email_user,a.domain,a.email_password,'@'||DB_LINK
		into l_user,l_domain,l_pass,l_dblink
		from iem_email_accounts a,iem_db_connections b
		where a.email_account_id=l_email_account_id
		and a.db_server_id=b.db_server_id
		and b.is_admin='A';
Line: 821

		update iem_migration_details
		set status='E',
		folder_status=null,
		STATUS_TEXT='Unable to Authenticate  USer '||l_user||'  Error Code '||l_ret
		where migration_id=p_migration_id;
Line: 830

	select count(*) into l_hist_count from iem_migration_store_temp
	where migration_id=p_migration_id;
Line: 846

		update iem_migration_details
		set status='E',
		folder_status=null,
		STATUS_TEXT='Unable to Open Folder'||l_folder||'  Error Code '||l_ret
		where migration_id=p_migration_id;
Line: 858

		l_msg_table.delete;
Line: 869

					l_mig_status:=null;	-- Update it to "R" later based on date
Line: 893

         					execute immediate 'select subject,TO_CHAR(sent_date,''DD-MON-YYYY HH24:MI:SS'') || '' GMT'',to_str,from_str,reply_to, cc_str, bcc_str,msg_size from '
           			||'OM_HEADER'||l_dblink||' where msg_id = :b1'
           		into l_mig_rec.subject,l_mig_rec.sent_date,l_mig_rec.to_str,l_mig_Rec.from_str,
				l_mig_rec.reply_to_str, l_mig_rec.cc_str, l_mig_rec.bcc_str,l_mig_rec.message_size using l_source_message_id;
Line: 898

						l_error_text:='Oracle Error Occured while selecting Header Information '||sqlerrm;
Line: 907

					  --execute immediate ' select value from om_ext_header'||l_dblink||' where msg_id =:b1 '||' AND upper(prompt)=''MESSAGE-ID:'' AND eh_type IN (80, 0)' into l_mig_rec.rfc822_message_id using l_source_message_id  ;
Line: 912

	          execute immediate ' select value from om_ext_header'||l_dblink||' where msg_id =:b1 '
			||' AND upper(prompt) IN (''MESSAGE-ID:'',''MESSAGEID:'') AND eh_type IN (80, 0) AND rownum = 1  order by order_no desc' into l_mig_rec.rfc822_message_id using l_source_message_id;
Line: 917

						l_error_text:='Oracle Error Occured while selecting Extended Header Information '||sqlerrm;
Line: 924

					select media_id into l_mig_rec.ih_media_item_id
          			from jtf_ih_media_items
          			where media_item_type = 'EMAIL'
					      and direction=l_direction
          			AND source_id=l_email_account_id
          			AND  media_item_ref=l_mig_rec.rfc822_message_id;
Line: 934

					-- and media information can be updated later  rtripath 10/31/2011 can be updated manually
					--	l_mig_Status:='E';
Line: 960

					delete from iem_migration_Store_temp where migration_id=p_migration_id and message_id=l_msg_table(i);
Line: 964

select IEM_MIGRATION_STORE_TEMP_s1.nextval into l_mig_rec.mail_id from dual;
Line: 969

	insert into iem_migration_store_temp
	(MAIL_ID,
 	MESSAGE_ID ,
	MIGRATION_ID,
 	MESSAGE_TYPE ,
 	EMAIL_ACCOUNT_ID ,
     AGENT_ACCOUNT_ID  ,
 	RESOURCE_ID       ,
 	FOLDER_NAME       ,
 	RT_MEDIA_ITEM_ID  ,
 	MSG_UID          ,
 	RFC822_MESSAGE_ID ,
 	FROM_STR       ,
 	TO_STR          ,
 	REPLY_TO_STR   ,
 	CC_STR         ,
 	BCC_STR          ,
 	SENT_DATE        ,
 	SUBJECT          ,
 	IH_MEDIA_ITEM_ID ,
 	MESSAGE_SIZE     ,
 	DP_STATUS        ,
 	MIG_STATUS       ,
 	ERROR_TEXT,
	message_content,
	CREATED_BY          ,
	CREATION_DATE       ,
	LAST_UPDATED_BY     ,
	LAST_UPDATE_DATE    ,
	LAST_UPDATE_LOGIN
	)
 VALUES
 	(l_mig_rec.mail_id,
 	l_mig_rec.message_id,
	p_migration_id,
	l_folder_type,
 	l_mig_rec.email_account_id,
 	l_mig_rec.agent_account_id,
 	l_mig_rec.resource_id,
	l_folder_name,
	null,
 	l_mig_rec.msg_uid,
 	l_mig_rec.RFC822_MESSAGE_ID,
 	l_mig_rec.from_Str,
 	l_mig_rec.to_str,
 	l_mig_rec.reply_to_str,
 	l_mig_rec.cc_str,
 	l_mig_rec.bcc_Str,
 	l_mig_rec.sent_Date,
	l_mig_rec.subject,
	l_mig_rec.ih_media_item_id,
	l_mig_rec.MESSAGE_SIZE,
	null,
	l_mig_status,
	l_error_text,
	l_content,
	l_created_by,
	sysdate,
	l_last_updated_by,
	sysdate,
	l_last_update_login);
Line: 1048

		update iem_migration_store_temp
		set mig_status='R'
		where mig_status is null and
		to_date(substr(sent_Date,1,20),'DD-MM-YYYY HH24:MI:SS','NLS_DATE_LANGUAGE=ENGLISH')>=l_hist_date;
Line: 1057

	select count(*) into l_rec_counter from iem_migration_Store_temp
	where migration_id=p_migration_id and mig_Status is not null;
Line: 1060

		select count(*) into l_error_counter from iem_migration_store_temp
		where migration_id=p_migration_id and mig_status='E' and dp_status is null;
Line: 1062

	update iem_migration_details
	set MSG_RECORD_COUNT=l_rec_counter-l_error_counter,
	folder_status='R',
	status='S'
	where migration_id=p_migration_id;
Line: 1074

	update iem_migration_details
	set status='E',
	folder_Status=null,
	status_text=l_error_text
	where migration_id=p_migration_id;
Line: 1089

		update iem_migration_details
		set status='E',
		folder_Status=null,
		--STATUS_TEXT='Oracle Error occured During Worklist item creation: '
    --added by siahmed
		STATUS_TEXT=l_error_text
		where migration_id=p_migration_id;
Line: 1113

 	cursor c1 is select * from iem_migration_store_temp
	where migration_id=l_id and (dp_status='E' or mig_Status='E');
Line: 1116

	cursor c_account is select email_account_id from iem_mstemail_accounts
	where active_flag in ('Y','N') ;
Line: 1121

		select folder_Status into l_folder_status
		from iem_migration_details
		where  migration_id=p_folders(i);
Line: 1135

		update iem_migration_details
		set folder_Status=l_new_status,
		status='S',
		status_text=null
		where migration_id=p_folders(i);
Line: 1140

		-- Update Status at message levels
		for v1 in c1 LOOP
		if v1.dp_status='E' then
			update iem_migration_store_temp
			set dp_status=null,
			error_text=null
			where mail_id=v1.mail_id;
Line: 1148

			update iem_migration_store_temp
			set mig_status=l_mig_status,
			error_text=null
			where mail_id=v1.mail_id;
Line: 1158

 				select count(*) into l_mig_count from iem_migration_details
 				where email_account_id=v1.email_account_id and nvl(folder_status,' ')<>'M'
				and folder_type<>'H';
Line: 1162

 					update iem_mstemail_accounts
					set active_flag='M'
					where email_account_id=v1.email_Account_id;
Line: 1184

	cursor c_account is select email_account_id from iem_mstemail_accounts
	where active_flag in ('Y','N') ;
Line: 1188

		select migration_id,mig_status,dp_status into l_mig_id,l_mig_status,l_dp_status
		from iem_migration_store_temp
		where mail_id=p_messages(i);
Line: 1192

			update iem_migration_store_temp
			set dp_status=null,
			error_text=null
			where mail_id=p_messages(i);
Line: 1196

			update iem_migration_details
			set folder_Status=null,
			status=null,
			status_text=null
			where migration_id=l_mig_id;
Line: 1210

			update iem_migration_store_temp
			set mig_status=l_mignew_status
			where mail_id=p_messages(i);
Line: 1213

			update iem_migration_details
			set folder_Status=null,
			status=null,
			status_text=null
			where migration_id=l_mig_id;
Line: 1223

 				select count(*) into l_mig_count from iem_migration_details
 				where email_account_id=v1.email_account_id and nvl(folder_status,' ')<>'M'
				and folder_type<>'H';
Line: 1227

 					update iem_mstemail_accounts
					set active_flag='M'
					where email_account_id=v1.email_Account_id;
Line: 1252

	cursor c_account is select email_account_id from iem_mstemail_accounts
	where active_flag in ('Y','N') ;
Line: 1257

	select count(*) into l_count from iem_comp_rt_stats
	where type='MIGRATION' and param='STATUS' ;
Line: 1261

	select count(*) into l_mig_count from iem_pre_mdts;
Line: 1266

	select count(rt_interaction_id) into l_mig_count
	from iem_rt_interactions where expire <> 'N' AND expire <> 'Y';
Line: 1310

				update iem_migration_details
				set folder_Status='M' where total_msg_count=0 and status='S';
Line: 1316

				select nvl(max(message_id),0) into l_id from iem_post_mdts;
Line: 1318

					select iem_ms_base_headers_s1.nextval into l_id1 from dual;
Line: 1327

			update iem_comp_rt_Stats
			set value='Y' where  type='MIGRATION' and param='STATUS' ;
Line: 1329

			select to_date(value,'YYYY/MM/DD HH24:MI:SS') into l_hist_date from
			iem_comp_rt_Stats where  type='HISTORICAL' and param='LASTRUN' ;
Line: 1332

				update iem_comp_rt_Stats
				set value=p_hist_date where  type='HISTORICAL' and param='LASTRUN' ;
Line: 1337

 				select count(*) into l_mig_count from iem_migration_details
 				where email_account_id=v1.email_account_id and folder_status<>'M';
Line: 1340

 					update iem_mstemail_accounts
					set active_flag='M'
					where email_account_id=v1.email_Account_id;
Line: 1381

	select distinct b.migration_id from iem_migration_store_temp a,iem_migration_details b
	where a.migration_id=b.migration_id and b.folder_Status='M' and a.dp_status=null;
Line: 1385

	select distinct migration_id,folder_Status from iem_migration_Details
	where migration_id in (select a.migration_id from iem_migration_store_temp a,iem_migration_details b
	where a.migration_id=b.migration_id and b.folder_Status='M'  and a.mig_Status in (null,'D'));
Line: 1388

	cursor c_account is select email_account_id from iem_mstemail_accounts
	where active_flag='M' ;
Line: 1394

	select count(*) into l_count from iem_comp_rt_stats
	where type='MIGRATION' and param='STATUS' and value='Y';
Line: 1399

	select count(*) into l_count from iem_comp_rt_stats
	where type='MIGRATION' and param='STATUS' and value='Y';
Line: 1403

	for x in ( select migration_id
 	from iem_migration_details
	where folder_Status is null
	and total_msg_count>0
 	order by decode(folder_type,'H',1,0))
LOOP
BEGIN
	select * into l_folder_rec from iem_migration_details
	where migration_id=x.migration_id FOR UPDATE NOWAIT;
Line: 1421

	update iem_migration_details
	set folder_status='P',
	status=null,
	status_Text=null
	where migration_id=l_migration_id;
Line: 1435

	select count(*) into l_count from iem_comp_rt_stats
	where type='MIGRATION' and param='STATUS' and value='Y';
Line: 1439

	for x in ( select migration_id
 	from iem_migration_details
	where folder_Status='D'
 	order by decode(folder_type,'H',1,0))
LOOP
BEGIN
	select * into l_folder_rec from iem_migration_details
	where migration_id=x.migration_id FOR UPDATE NOWAIT;
Line: 1457

	update iem_migration_details
	set folder_status='M'
	where migration_id=l_migration_id;
Line: 1460

	update iem_migration_Store_temp
	set mig_status='M'
	where migration_id=l_migration_id
	and dp_status='D';
Line: 1466

	update iem_migration_details
	set folder_status='V'
	where migration_id=l_migration_id;
Line: 1477

 select count(*) into l_mig_count from iem_migration_details
 where email_account_id=v1.email_account_id and folder_status<>'M'
 and folder_type<>'H';
Line: 1481

 	update iem_mstemail_accounts
	set active_flag='N'
	where email_account_id=v1.email_Account_id;
Line: 1492

 update iem_comp_rt_Stats
 set value='N' where  type='MIGRATION' and param='STATUS' ;
Line: 1521

cursor c_account is select * from iem_email_accounts where email_account_id not in
(select email_account_id from iem_mstemail_accounts);
Line: 1523

cursor c_agent is select * from iem_agent_Accounts where agent_account_id not in
(select agent_id from iem_agents);
Line: 1526

 select distinct a.classification_id,a.classification from
 iem_classifications a
 where  a.email_account_id=l_email_account_id;
Line: 1530

 cursor c1 is select * from iem_themes where classification_id=l_intent_id
 and score>0;
Line: 1541

 l_LAST_UPDATED_BY    NUMBER ;
Line: 1542

 l_LAST_UPDATE_LOGIN    NUMBER;
Line: 1550

l_deleted_flag		varchar2(1);
Line: 1554

cursor c_rule is select email_user,domain from iem_email_accounts
where upper(email_user) not in ('ACKNOWLEDGEMENTS');
Line: 1559

l_LAST_UPDATED_BY:=nvl(TO_NUMBER (FND_PROFILE.VALUE('USER_ID')),-1);
Line: 1560

l_last_update_login:=nvl(TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ ID')),-1);
Line: 1565

	select to_number(decode(FND_PROFILE.VALUE_SPECIFIC('IEM_ACCOUNT_SENDER_NAME'),'ACCOUNT',0,1)) into
	l_sender_profile from dual;
Line: 1567

	select dns_name,port
	into l_in_host,l_in_port
	from iem_email_servers a,iem_email_server_types b
	where a.server_type_id=b.email_server_type_id and
	b.email_server_type='IMAP' and
	a.server_group_id=v1.server_group_id;
Line: 1574

	select dns_name,port
	into l_out_host,l_out_port
	from iem_email_servers a,iem_email_server_types b
	where a.server_type_id=b.email_server_type_id and
	b.email_server_type='SMTP' and
	a.server_group_id=v1.server_group_id;
Line: 1582

		select a.db_link into l_dblink
         from iem_db_connections a, iem_email_accounts b
         where a.db_server_id=b.db_Server_id
           and b.email_account_id = l_email_account_id and a.is_admin='A';
Line: 1591

		select kem_flag into l_flag from iem_email_Accounts
		where email_account_id=v1.email_Account_id;
Line: 1594

			select decode(v1.acct_language,'GB',1,2) into l_flag from dual;
Line: 1599

			select decode(v1.acct_language,'GB',1,2) into l_flag from dual;
Line: 1610

		l_deleted_flag:='Y';
Line: 1612

		l_deleted_flag:='N';
Line: 1623

	insert into iem_mstemail_accounts
	(EMAIL_ACCOUNT_ID,
	 EMAIL_ADDRESS ,
	 ACCOUNT_DESC,
	 USER_NAME ,
	 ACTIVE_FLAG ,
	 DELETED_FLAG,
	 TEMPLATE_CATEGORY,
	 SENDER_FLAG,
	 ACCOUNT_LANGUAGE ,
	 REPLY_TO_ADDRESS,
	 RETURN_ADDRESS,
	 FROM_NAME    ,
	 IN_HOST ,
	 OUT_HOST,
	 IN_PORT ,
	 OUT_PORT ,
	 CUSTOM_ENABLED  ,
	 SC_LANG  ,
	 KEM_FLAG  ,
	 ACCOUNT_TYPE,
	 CREATED_BY ,
	 CREATION_DATE  ,
	 LAST_UPDATED_BY  ,
	 LAST_UPDATE_DATE ,
 	LAST_UPDATE_LOGIN )
	VALUES
	(v1.email_Account_id,
	v1.reply_to_Address,
	v1.account_profile,
	v1.email_user,
	'M',
	l_deleted_flag,
	l_template_profile,
	l_sender_profile,
	v1.acct_language,
	v1.reply_to_address,
	v1.reply_to_address,
	v1.from_name,
	l_in_host,
	l_out_host,
	l_in_port,
	l_out_port,
	v1.custom_enabled,
	l_sc_lang,
	l_flag,
	'E',
	l_created_by,
	sysdate,
	l_last_updated_by,
	sysdate,
	l_last_update_login);
Line: 1677

		update iem_mstemail_accounts
		set deleted_flag='Y'
		where user_name=v1.email_user;
Line: 1695

insert into iem_intents
(intent_id,
intent,
INTENT_LANG,
THEME_ENABLED,
 CREATED_BY ,
 CREATION_DATE  ,
 LAST_UPDATED_BY  ,
 LAST_UPDATE_DATE ,
 LAST_UPDATE_LOGIN )
VALUES
(v2.classification_id,
v2.classification,
l_acct_language,
l_theme_enabled,
l_created_by,
sysdate,
l_last_updated_by,
sysdate,
l_last_update_login);
Line: 1715

	-- Insert into iem_ACCOUNT_INTENTS
	insert into iem_account_intents
	(intent_id,
	email_account_id,
 	CREATED_BY ,
 	CREATION_DATE  ,
 	LAST_UPDATED_BY  ,
 	LAST_UPDATE_DATE ,
 	LAST_UPDATE_LOGIN )
	VALUES
	(v2.classification_id,
	 l_email_account_id,
	l_created_by,
	sysdate,
	l_last_updated_by,
	sysdate,
	l_last_update_login);
Line: 1733

	-- Insert into IEM_INTENT_DTLS
	for v3 in c1 LOOP
	select iem_intent_dtls_s1.nextval into l_intent_dtl_id from dual;
Line: 1742

	insert into iem_intent_dtls
	(INTENT_DTL_ID,
	 INTENT_ID,
	 KEYWORD,
	 WEIGHT,
	 QUERY_RESPONSE,
 	CREATED_BY ,
 	CREATION_DATE  ,
 	LAST_UPDATED_BY  ,
	 LAST_UPDATE_DATE ,
	 LAST_UPDATE_LOGIN )
	 VALUES
	 (l_intent_dtl_id,
	 l_intent_id,
	 v3.theme,
	 l_weight,
	 v3.query_Response,
	 v3.created_by,
	 sysdate,
	 v3.last_updated_by,
	 sysdate,
	 v3.last_update_login);
Line: 1769

insert into IEM_AGENTS
(AGENT_ID,
email_account_id,
RESOURCE_ID,
signature,
 CREATED_BY ,
 CREATION_DATE  ,
 LAST_UPDATED_BY  ,
 LAST_UPDATE_DATE ,
 LAST_UPDATE_LOGIN )
VALUES
(v4.agent_account_id,
v4.email_Account_id,
v4.resource_id,
v4.signature,
l_created_by,
sysdate,
l_last_updated_by,
sysdate,
l_last_update_login);
Line: 1792

 update iem_route_classifications
 set deleted_flag='N'
 where deleted_flag is null;		-- So that can be re runnable..
Line: 1796

 select nvl(max(email_account_id),0) into l_max_id from iem_mstemail_accounts;
Line: 1798

 select iem_mstemail_accounts_s1.nextval into l_val from dual;
Line: 1804

 select nvl(max(agent_id),0) into l_max_id from iem_agents;
Line: 1806

 select iem_agents_s1.nextval into l_val from dual;
Line: 1812

 select nvl(max(intent_id),0) into l_max_id from iem_intents;
Line: 1814

 select iem_intents_s1.nextval into l_val from dual;
Line: 1820

 execute immediate 'select rule_id from ds_account@'||l_dblink||' a,om_server_rules@'||l_dblink||' b,ds_domain@'||l_dblink||' c where a.objectid=b.account_id and a.domainid=c.objectid
 and upper(a.name)=:user1
 and upper(c.qualifiedname)=:name'
 into l_rule_id using upper(v1.email_user),upper(v1.domain);
Line: 1824

 execute immediate 'delete from om_Server_rules@'||l_dblink||'  where rule_id=:id' using l_rule_id;
Line: 1891

   l_msg_table.delete;
Line: 1892

   l_messages.delete;
Line: 1931

  G_MSG_TABLE.DELETE;