DBA Data[Home] [Help]

APPS.IEM_MAILITEM_PUB SQL Statements

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

Line: 18

 	SELECT a.EMAIL_ACCOUNT_ID,a.RT_CLASSIFICATION_ID,
	b.USER_NAME,c.name,count(*) Total,
	nvl(max(sysdate-a.received_date)*24*60,0) wait_time
 	FROM iem_rt_proc_emails a,iem_mstemail_accounts b,
	iem_route_classifications c,iem_agents d
	WHERE a.resource_id=0
	and a.email_account_id=b.email_account_id
	and a.rt_classification_id=c.route_classification_id
	AND a.email_account_id=d.email_account_id
	AND d.resource_id=p_resource_id
	AND a.group_id in (select * from TABLE(cast(i_tbl as jtf_number_table)))
	and a.message_id not in (select message_id from iem_reroute_hists where agent_id=p_resource_id)
 	GROUP by a.email_account_id,a.rt_classification_id,b.USER_NAME,c.name;
Line: 32

 	SELECT a.EMAIL_ACCOUNT_ID,a.RT_CLASSIFICATION_ID,
	b.USER_NAME,c.name,count(*) Total,
	nvl(max(sysdate-a.received_date)*24*60,0) wait_time
 	FROM iem_rt_proc_emails a,iem_mstemail_accounts b,
	iem_route_classifications c,iem_agents d
	WHERE a.resource_id=0
	and a.email_account_id=b.email_account_id
	and a.rt_classification_id=c.route_classification_id
	AND a.email_account_id=d.email_account_id
	AND d.resource_id=p_resource_id
	AND (a.group_id in (select group_id from jtf_rs_group_members where resource_id=p_resource_id
					and delete_flag<>'Y')
		or (a.group_id=0))
	and a.message_id not in (select message_id from iem_reroute_hists where agent_id=p_resource_id)
 	GROUP by a.email_account_id,a.rt_classification_id,b.USER_NAME,c.name;
Line: 48

	select a.email_account_id,a.rt_classification_id,
	b.USER_NAME,c.name,Count(*) Total,
	nvl(max(sysdate-a.received_date)*24*60,0) wait_time,
     max(decode(a.mail_item_status,'A',1,'N',1,'T',1,0)) email_status
 	FROM iem_rt_proc_emails a,iem_mstemail_accounts b,
	iem_route_classifications c
	WHERE a.resource_id=p_resource_id
	and a.email_account_id=b.email_account_id
	and a.rt_classification_id=c.route_classification_id
	and a.queue_status is null
 	GROUP by a.email_account_id,a.rt_classification_id,b.USER_NAME,c.name;
Line: 90

SAVEPOINT select_mail_count_pvt;
Line: 93

	select count(*) into l_count
	from jtf_rs_group_members
	where resource_id=p_resource_id
	and delete_flag<>'Y';
Line: 181

	ROLLBACK TO select_mail_count_PVT;
Line: 187

	 ROLLBACK TO select_mail_count_PVT;
Line: 193

	ROLLBACK TO select_mail_count_PVT;
Line: 200

	ROLLBACK TO select_mail_count_PVT;
Line: 207

	ROLLBACK TO select_mail_count_PVT;
Line: 239

 	SELECT a.RT_CLASSIFICATION_ID,b.name,COUNT(*) TOTAL
 	FROM iem_rt_proc_emails a,iem_route_classifications b
	where a.email_account_id=p_email_account_id
	and a.resource_id =0
	and a.rt_classification_id=b.route_classification_id
	AND a.group_id in (select * from TABLE(cast(i_tbl as jtf_number_table)))
 	GROUP by a.rt_classification_id,b.name;
Line: 265

SAVEPOINT select_item_PVT;
Line: 320

	 ROLLBACK TO select_item_PVT;
Line: 326

	ROLLBACK TO select_item_PVT;
Line: 333

	ROLLBACK TO select_item_PVT;
Line: 340

	ROLLBACK TO select_item_PVT;
Line: 367

 cursor c2 is select a.rt_classification_id,b.name,count(*) total
 from iem_rt_proc_emails a,iem_route_classifications b
 where a.email_account_id=p_email_account_id
 and a.resource_id=0
 and a.rt_classification_id=b.route_classification_id
 group by rt_classification_id,b.name;
Line: 389

SAVEPOINT select_item_PVT;
Line: 414

	 ROLLBACK TO select_item_PVT;
Line: 420

	ROLLBACK TO select_item_PVT;
Line: 427

	ROLLBACK TO select_item_PVT;
Line: 434

	ROLLBACK TO select_item_PVT;
Line: 479

SAVEPOINT select_item_PVT;
Line: 511

 	select COUNT(*)
	INTO x_count
 	from iem_rt_proc_emails
	where email_account_id=p_email_account_id
	and rt_classification_id=p_classification_id
 	and resource_id=0
	and group_id in (select * from TABLE(cast(i_tbl as jtf_number_table)));
Line: 532

	 ROLLBACK TO select_item_PVT;
Line: 538

	ROLLBACK TO select_item_PVT;
Line: 545

	ROLLBACK TO select_item_PVT;
Line: 552

	ROLLBACK TO select_item_PVT;
Line: 615

SAVEPOINT select_data_PVT;
Line: 620

'select /*FIRST_ROWS*/ * from iem_rt_proc_emails p where message_id not in (select message_id from iem_reroute_hists where resource_id=:res1 ) and  email_account_id=:id
and rt_classification_id=:rt
and resource_id=0
and ( p.group_id = 0
      or exists (
         select null
         from   jtf_rs_group_members gm
         where  resource_id=:res
         and    gm.group_id = p.group_id
         and    delete_flag <>''Y''
         )
    )
order by received_date for update skip locked'
using p_resource_id,p_account_id,p_rt_classification,p_resource_id;
Line: 647

'select /*FIRST_ROWS*/ * from iem_rt_proc_emails p where message_id not in (select message_id from iem_reroute_hists where resource_id=:res1 ) and  email_account_id=:id
and resource_id=0
and ( p.group_id = 0
      or exists (
         select null
         from   jtf_rs_group_members gm
         where  resource_id=:res
         and    gm.group_id = p.group_id
         and    delete_flag <>''Y''
         )
    )
order by received_date for update skip locked'
using p_resource_id,p_account_id,p_resource_id;
Line: 673

	l_tag_key_value.delete;
Line: 692

	UPDATE iem_rt_proc_emails
	set resource_id=p_resource_id,
	queue_status='G'
	where message_id=x_email_data.message_id ;
Line: 699

     		JTF_IH_PUB.Update_Interaction( p_api_version     => 1.0,
                                  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: 725

	 ROLLBACK TO select_data_PVT;
Line: 731

	ROLLBACK TO select_data_PVT;
Line: 738

	ROLLBACK TO select_data_PVT;
Line: 747

	ROLLBACK TO select_data_PVT;
Line: 791

	SELECT IH_MEDIA_ITEM_ID into l_media_id
	FROM iem_rt_proc_emails
	WHERE MESSAGE_ID=p_message_id;
Line: 794

	SELECT * into l_media_data
	FROM JTF_IH_MEDIA_ITEMS
	WHERE MEDIA_ID=l_media_id;
Line: 818

	DELETE FROM iem_rt_proc_emails
	WHERE MESSAGE_ID=p_message_id;
Line: 820

	delete from iem_reroute_hists
	where message_id=p_message_id;
Line: 822

	delete from iem_kb_results where message_id=p_message_id;
Line: 823

	delete from iem_email_classifications where message_id=p_message_id;
Line: 824

	delete from iem_comp_rt_stats where type='WORKFLOW' and param=to_char(p_message_id);
Line: 827

     delete from iem_encrypted_tags
	where message_id=p_message_id;
Line: 895

select group_id bulk collect into x_tbl
from jtf_rs_group_members
where resource_id=p_resource_id
and delete_flag<>'Y';
Line: 952

PROCEDURE UpdateMailItem (p_api_version_number    IN   NUMBER,
 		  	      p_init_msg_list  IN   VARCHAR2 ,
		    	      p_commit	    IN   VARCHAR2 ,
				p_email_data in  iem_rt_proc_emails%rowtype,
		     	x_return_status	OUT NOCOPY	VARCHAR2,
  		     	x_msg_count	      OUT NOCOPY	   NUMBER,
	  	     	x_msg_data	OUT NOCOPY	VARCHAR2) IS

	l_api_name        		VARCHAR2(255):='UpdateMailItem';
Line: 962

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

     l_LAST_UPDATE_DATE    DATE:=SYSDATE;
Line: 964

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

SAVEPOINT update_item_PVT;
Line: 977

   UPDATE iem_rt_proc_emails
   SET
		resource_id         =p_email_data.resource_id,
		PRIORITY            =p_email_data.priority,
		MSG_STATUS      =p_email_data.msg_status,
		SUBJECT             =p_email_data.subject,
		SENT_DATE           =p_email_data.sent_date,
		CUSTOMER_ID         =p_email_data.customer_id,
		CONTACT_ID         =p_email_data.CONTACT_ID,
		RELATIONSHIP_ID          =p_email_data.RELATIONSHIP_ID,
		RECEIVED_DATE		=p_email_data.received_date,
		MAIL_ITEM_STATUS    =p_email_data.mail_item_status,
          LAST_UPDATE_DATE = sysdate,
          LAST_UPDATED_BY = decode(l_LAST_UPDATED_BY,null,-1,l_LAST_UPDATED_BY),
          LAST_UPDATE_LOGIN =decode(l_LAST_UPDATE_LOGIN,null,-1,l_LAST_UPDATE_LOGIN),
     ATTRIBUTE1 =p_email_data.attribute1,
     ATTRIBUTE2 =p_email_data.attribute2,
     ATTRIBUTE3 =p_email_data.attribute3,
     ATTRIBUTE4 = p_email_data.attribute4,
     ATTRIBUTE5 = p_email_data.attribute5,
     ATTRIBUTE6 = p_email_data.attribute6,
     ATTRIBUTE7 = p_email_data.attribute7,
     ATTRIBUTE8 = p_email_data.attribute8,
     ATTRIBUTE9 = p_email_data.attribute9,
     ATTRIBUTE10 =p_email_data.attribute10,
     ATTRIBUTE11 = p_email_data.attribute11,
     ATTRIBUTE12 = p_email_data.attribute12,
     ATTRIBUTE13 = p_email_data.attribute13,
     ATTRIBUTE14 = p_email_data.attribute14,
     ATTRIBUTE15 = p_email_data.attribute15
WHERE message_id=p_email_data.message_id;
Line: 1020

	ROLLBACK TO update_item_PVT;
Line: 1027

	ROLLBACK TO update_item_PVT;
Line: 1034

	ROLLBACK TO update_item_PVT;
Line: 1049

 END	UpdateMailItem;
Line: 1077

	SELECT *
	INTO x_email_data
	FROM iem_rt_proc_emails
	WHERE   message_id=p_message_id;
Line: 1089

	SELECT *
	INTO x_email_data
	FROM iem_rt_proc_emails
	WHERE   message_id=p_message_id;
Line: 1179

   select decode(p_sort_order,0,'ASC','DESC')
   into l_sort_order
   from dual;
Line: 1197

   'SELECT a.message_id,a.rt_classification_id,c.name,b.rt_media_item_id,
    b.rt_interaction_id,
    a.email_account_id,a.message_flag,a.from_address,a.subject,a.priority,a.msg_status,
    to_char(to_date(substr(a.sent_Date,1,20),''DD-MON-YYYY HH24:MI:SS''),''MM/DD/RRRR HH24:MI:SS''),a.mail_item_status,
   -- to_char(to_date(substr(a.sent_Date,5,length(a.sent_Date)-13)||substr(a.sent_date,25,4),''Mon DD hh24:mi:ssyyyy''),''MM/DD/RRRR HH24:MI:SS''),a.mail_item_status,
    a.from_resource_id,
    decode(a.mail_item_status,''R'',1,''S'',1,0) read_status,d.description
    FROM iem_rt_proc_emails a,
	  IEM_RT_MEDIA_ITEMS b,
    IEM_ROUTE_CLASSIFICATIONS c,
    FND_LOOKUPS d
    WHERE A.RT_CLASSIFICATION_ID=C.ROUTE_CLASSIFICATION_ID AND B.EXPIRE=:expire AND A.MESSAGE_ID=B.MESSAGE_ID and a.resource_id=:id and a.email_account_id=:account_id and
    substr(a.mail_item_status,1,1)=d.lookup_code and d.lookup_type=:status_type '||l_order_by
    using l_expire,p_resource_id,p_email_account_id,l_status_type;
Line: 1211

    l_temp_tbl.delete;
Line: 1219

  IF l_temp_tbl.count>0  THEN	-- Data Selected Now implement Display Logic
	x_total_message:=l_temp_tbl.count;
Line: 1310

SAVEPOINT select_data_PVT;
Line: 1312

   SELECT * INTO x_email_data
   FROM iem_rt_proc_emails
   WHERE message_id=p_message_id
   AND resource_id=0 for update;
Line: 1316

	update iem_rt_proc_emails
	set from_resource_id=p_from_agent_id,
	    resource_id=p_to_agent_id,
	    mail_item_status=p_mail_item_status
	    where message_id=p_message_id;
Line: 1321

	l_tag_key_value.delete;
Line: 1350

	 ROLLBACK TO select_data_PVT;
Line: 1356

	ROLLBACK TO select_data_PVT;
Line: 1363

	ROLLBACK TO select_data_PVT;
Line: 1370

	ROLLBACK TO select_data_PVT;
Line: 1428

	insert_arch_dtl_error	EXCEPTION;
Line: 1429

	cursor c1 is select a.classification,b.score from
	iem_classifications a,iem_email_classifications b
	where b.message_id=p_message_id
	and a.classification_id=b.classification_id
	order by score asc;
Line: 1448

SAVEPOINT select_data_PVT;
Line: 1450

	select * into l_msg_rec from iem_rt_proc_emails
	where message_id=p_message_id;
Line: 1454

	SELECT * into l_media_data
	FROM JTF_IH_MEDIA_ITEMS
	WHERE MEDIA_ID=l_msg_rec.ih_media_item_id;
Line: 1478

	select * into l_header_rec from iem_ms_base_headers
	where message_id=p_message_id;
Line: 1480

	select value into l_msg_text from iem_ms_msgbodys
	where message_id=p_message_id and rownum=1;
Line: 1486

	-- Insert Record into IEM_ARCH_MSG_DTLS
	IEM_ARCH_MSGDTLS_PVT.create_item(
		P_API_VERSION_NUMBER=>1.0,
 		P_INIT_MSG_LIST=>'F',
 		P_COMMIT=>'F',
 		P_message_id=>p_message_id,
		p_inbound_message_id=>null,
 		P_EMAIL_ACCOUNT_ID=>l_msg_rec.email_account_id,
 		P_MAILPROC_STATUS=>p_action_flag,
 		P_RT_CLASSIFICATION_ID=>l_msg_rec.rt_classification_id,
 		P_MAIL_TYPE=>0,
 		P_FROM_STR=>l_header_rec.from_str,
 		P_REPLY_TO_STR=>l_header_rec.reply_to_str,
 		P_TO_STR=>l_header_rec.to_str,
		P_CC_STR=>l_header_rec.cc_str,
		P_BCC_STR=>null,
 		P_SENT_DATE=>l_msg_rec.sent_date,
 		P_RECEIVED_DATE=>l_msg_rec.received_date,
 		P_SUBJECT=>l_msg_rec.subject,
 		P_AGENT_ID=>l_msg_rec.resource_id,
 		P_GROUP_ID=>l_msg_rec.group_id,
 		P_IH_MEDIA_ITEM_ID=>l_msg_rec.ih_media_item_id,
 		P_CUSTOMER_ID=>l_msg_rec.customer_id,
 		P_MESSAGE_SIZE=>null,
 		P_CONTACT_ID=>l_msg_rec.contact_id,
 		P_RELATIONSHIP_ID=>l_msg_rec.relationship_id,
 		P_TOP_INTENT=>l_top_intent,
 		P_MESSAGE_TEXT=>l_msg_text,
    		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_message_id=>l_out_message_id,
 		X_RETURN_STATUS=>l_ret_status,
 		X_MSG_COUNT=>l_msg_count,
		 X_MSG_DATA=>l_msg_data);
Line: 1534

		raise insert_arch_dtl_error;
Line: 1536

	-- Delete All RUN TIME DATA and MESSAGE DATA FROM PRIMARY STORE
	delete from iem_rt_proc_emails where message_id=p_message_id;
Line: 1538

	delete from iem_email_classifications where message_id=p_message_id;
Line: 1539

	delete from iem_kb_results where message_id=p_message_id;
Line: 1540

	delete from iem_ms_base_headers where message_id=p_message_id;
Line: 1541

	delete from iem_ms_msgbodys where message_id=p_message_id;
Line: 1542

	delete from iem_ms_msgparts where message_id=p_message_id;
Line: 1543

	delete from iem_ms_exthdrs where message_id=p_message_id;
Line: 1545

	-- Insert the MIME Message into Archived Message Stores
	insert into iem_arch_msgs(message_id,message_content,created_by,creation_date,last_updated_by,last_update_date,last_update_login)
	(
	select message_id,mime_msg,created_by,creation_date,last_updated_by,last_update_date,last_update_login from iem_ms_mimemsgs where message_id=p_message_id and draft_flag=0);
Line: 1549

	delete from iem_ms_mimemsgs where message_id=p_message_id;