The following lines contain the word 'select', 'insert', 'update' or 'delete':
select ame_exceptions_log_s.nextval
into l_log_id
from dual;
insert into ame_exceptions_log
(log_id,package_name,routine_name,transaction_id,application_id,exception_number,exception_string)
values
(l_log_id,'ame_update_username_pkg','update_username','','',p_errorcode,to_char(sysdate, 'YYYY:MM:DD:HH24:MI:SS')|| p_message);
procedure update_username
(itemtype in varchar2
,itemkey in varchar2
,actid in number
,funcmode in varchar2
,resultout in out nocopy varchar2
) as
l_event_key varchar2(650);
update ame_config_vars acv
set acv.variable_value = l_new_name
where acv.variable_value = l_old_name
and acv.variable_name = 'adminApprover';
update ame_approval_group_items aagi
set aagi.parameter = l_new_name
where aagi.parameter = l_old_name
and aagi.parameter_name = 'wf_roles_name';
update ame_approval_group_members aagm
set aagm.parameter = l_new_name
where aagm.parameter = l_old_name
and aagm.parameter_name = 'wf_roles_name';
update ame_conditions ac
set ac.parameter_two = l_new_name
where ac.parameter_two = l_old_name
and ac.attribute_id = 0;
update ame_actions aa
set aa.parameter = l_new_name,
aa.description = replace(aa.description,l_old_name,l_new_name)
where aa.parameter = l_old_name
and exists (select aat.action_type_id
from ame_action_types aat
where aat.action_type_id = aa.action_type_id
and aat.name = 'substitution');
update ame_temp_old_approver_lists atoal
set atoal.name = l_new_name
where atoal.name = l_old_name;
log_message('Migrating name field in ame_temp_insertions');
update ame_temp_insertions ati
set ati.name = l_new_name
where ati.name = l_old_name;
update ame_temp_deletions atd
set atd.name = l_new_name
where atd.name = l_old_name;
log_message('Migrating parameter field in ame_temp_insertions');
update ame_temp_insertions ati
set ati.parameter = l_new_name ||
substrb(ati.parameter
,instrb(ati.parameter
,fnd_global.local_chr(11)
,1
,1)
,(lengthb(ati.parameter) - instrb(ati.parameter
,fnd_global.local_chr(11)
,1
,1) + 1))
where ati.order_type in ('before approver','after approver')
and instrb(ati.parameter,l_old_name,1,1) = 1;
log_message('Migrating description field in ame_temp_insertions');
update ame_temp_insertions ati
set ati.description = decode(order_type
,'after_approver'
,'Always put the new approver right after the following approver: ' || l_new_name
,'Always put the new approver right before the following approver: ' || l_new_name)
where ati.order_type in ('before approver','after approver')
and exists (select aca.application_id
from ame_calling_apps aca
where aca.application_id = ati.application_id)
and instrb(ati.parameter,l_new_name,1,1) = 1
and exists (select wr.name
from wf_roles wr
where wr.name = l_new_name
and wr.orig_system = 'FND_USR');
update ame_trans_approval_history atah
set atah.name = l_new_name
where atah.name = l_old_name;
select variable_value
into admin_approver
from ame_config_vars
where sysdate between start_date and nvl(end_date - (1/86400),sysdate)
and variable_name = 'adminApprover'
and (application_id is null or application_id = 0)
and rownum < 2;
select variable_value
into admin_approver
from ame_config_vars
where sysdate between start_date and nvl(end_date - (1/86400),sysdate)
and variable_name = 'adminApprover'
and (application_id is null or application_id = 0)
and rownum < 2;
end update_username;