The following lines contain the word 'select', 'insert', 'update' or 'delete':
G_created_updated_by NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('USER_ID')) ;
G_LAST_UPDATE_LOGIN NUMBER:=TO_NUMBER (FND_PROFILE.VALUE('LOGIN_ID') ) ;
select folder_type, count(*) total from iem_migration_details
where folder_status='R'
group by folder_type
order by decode(folder_type,'H',1,
'N',2,
'Q',3,
'I',4,
'D',5,
0 ) desc;
select a.email_account_id,a.email_user||'@'||a.domain as user_name,
a.email_password,b.dns_name, b.port, c.migration_id, c.folder_name
from iem_email_accounts a, iem_email_servers b, iem_migration_details c,
iem_server_groups d, iem_email_server_types e
where ( c.folder_status='R' )
and c.folder_type= p_type and c.email_account_id=a.email_account_id
and a.server_group_id=d.server_group_id
and d.server_group_id=b.server_group_id and b.server_type_id=e.email_server_type_id
and upper(e.email_server_type)='IMAP';
select c.email_account_id,a.email_user||'@'||a.domain as user_name,
a.email_password,d.dns_name, d.port, c.migration_id, c.folder_name
from iem_agent_accounts a, iem_email_accounts b,
iem_migration_details c, iem_email_servers d, iem_server_groups e,
iem_email_server_types f
where ( c.folder_status='R' )
and c.folder_type= p_type and c.email_account_id=a.email_account_id
and c.agent_account_id=a.agent_account_id
and b.server_group_id=e.server_group_id
and b.email_account_id = a.email_account_id
and d.server_type_id=f.email_server_type_id
and upper(f.email_server_type)='IMAP';
update iem_migration_details a set a.folder_status='D', a.last_update_date=sysdate, a.msg_download_count=
(select count(*) from iem_migration_store_temp
where dp_status='D' and migration_id = a.migration_id)
where a.folder_status='R' and a.msg_record_count =
( (select count(*) from iem_migration_store_temp
where dp_status='D' and migration_id = a.migration_id)
+
( select count(*) from iem_migration_store_temp
where dp_status='E' and migration_id = a.migration_id));
update iem_migration_details a set a.last_update_date=sysdate, a.msg_download_count=
(select count(*) from iem_migration_store_temp
where dp_status='D' and migration_id = a.migration_id)
where a.folder_status='R';
select count(*) into l_available from iem_migration_store_temp
where migration_id=v_agent_folder_details.migration_id
and mig_status<>'E' and dp_status is null;
select count(*) into l_available from iem_migration_store_temp
where migration_id=v_folder_details.migration_id
and mig_status<>'E' and dp_status is null;
for y in ( select mail_id
from iem_migration_store_temp
where migration_id=p_migration_id and mig_status<>'E'and dp_status is null
order by creation_date asc )
loop
BEGIN
select * into l_queue_rec from iem_migration_store_temp
where migration_id=p_migration_id and mig_status<>'E' and dp_status is null
and mail_id=y.mail_id
FOR UPDATE NOWAIT;
update iem_migration_store_temp set dp_status ='A', last_update_date=sysdate
where migration_id=p_migration_id and mail_id=l_queue_rec.mail_id;
update iem_migration_store_temp set dp_status='E', error_text=l_error
where mail_id=p_mail_ids(i);
update iem_migration_details set status='E', status_text=l_error
where migration_id=p_migration_id;