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,p_package,p_routine,'','',p_errorcode,to_char(sysdate, 'YYYY:MM:DD:HH24:MI:SS')|| p_message);
select aagc.application_id,
aagc.approval_group_id
from ame_approval_group_config aagc
where sysdate between aagc.start_date
and nvl(aagc.end_date - (1/86400),sysdate)
and not exists
(select null
from ame_action_usages aau,
ame_rule_usages aru,
ame_actions aa,
ame_action_types aat
where aa.action_id = aau.action_id
and aau.rule_id = aru.rule_id
and aru.item_id = aagc.application_id
and sysdate between aa.start_date
and nvl(aa.end_date - (1/86400),sysdate)
and sysdate between aat.start_date
and nvl(aat.end_date - (1/86400),sysdate)
and aa.parameter = to_char(aagc.approval_group_id)
and aat.action_type_id = aa.action_type_id
and aat.name in ('pre-chain-of-authority approvals'
,'post-chain-of-authority approvals'
,'approval-group chain of authority')
and rownum < 2)
order by aagc.application_id;
update ame_approval_group_config master_cfg
set master_cfg.end_date = l_migration_date
where sysdate between master_cfg.start_date
and nvl(master_cfg.end_date - (1/86400),sysdate)
and master_cfg.application_id = l_application_id
and master_cfg.approval_group_id = l_approval_group_id;
select aatc.application_id,
aatc.action_type_id
from ame_action_type_config aatc
where sysdate between aatc.start_date
and nvl(aatc.end_date - (1/86400),sysdate)
and not exists
(select /*+ use_nl (aa aru) */ null
from ame_actions aa,
ame_action_usages aau,
ame_rule_usages aru
where sysdate between aa.start_date
and nvl(aa.end_date - (1/86400),sysdate)
and aa.action_id = aau.action_id
and aau.rule_id = aru.rule_id
and aru.item_id = aatc.application_id
and aa.action_type_id = aatc.action_type_id
and rownum < 2)
order by aatc.application_id;
update ame_action_type_config master_cfg
set master_cfg.end_date = l_migration_date
where sysdate between master_cfg.start_date
and nvl(master_cfg.end_date - (1/86400),sysdate)
and master_cfg.application_id = l_application_id
and master_cfg.action_type_id = l_action_type_id;
update ame_action_type_config acf
set chain_ordering_mode = null
,voting_regime = null
where (chain_ordering_mode is not null or
voting_regime is not null)
and action_type_id not in
(select action_type_id
from ame_action_type_usages
where rule_type = ame_util.authorityRuleType
and sysdate between start_date and nvl(end_date,sysdate)
)
and sysdate between start_date and nvl(end_date,sysdate);