The following lines contain the word 'select', 'insert', 'update' or 'delete':
select asg.business_group_id,
asg.payroll_id,
ptp.time_period_id,
pay_payroll_actions_s.nextval
into l_business_group_id,
l_payroll_id,
l_time_period_id,
l_payroll_action_id
from per_assignments_f asg,
per_time_periods ptp
where asg.assignment_id = p_assignment_id
and p_effective_date between
asg.effective_start_date and asg.effective_end_date
and ptp.payroll_id = asg.payroll_id
and p_effective_date between
ptp.start_date and ptp.end_date;
update pay_element_entries_f pee
set pee.creator_type = 'B',
pee.balance_adj_cost_flag = p_balance_adj_cost_flag
where pee.element_entry_id = l_element_entry_id
and p_effective_date between
pee.effective_start_date and pee.effective_end_date;
delete_adjustment
DESCRIPTION
Deletes an existing balance adjustment.
NOTES
*/
procedure delete_adjustment
(
p_validate in boolean default false,
p_effective_date in date,
p_element_entry_id in number
) is
l_payroll_action_id number;
l_proc varchar2(72) := g_package ||'delete_adjustment';
savepoint delete_adjustment;
select act.payroll_action_id
,act.assignment_action_id
into l_payroll_action_id
,l_assignment_action_id
from pay_payroll_actions ppa,
pay_assignment_actions act,
pay_element_entries_f pee
where pee.element_entry_id = p_element_entry_id
and pee.entry_type = 'B'
and p_effective_date between
pee.effective_start_date and pee.effective_end_date
and act.assignment_action_id = pee.creator_id
and ppa.payroll_action_id = act.payroll_action_id
and ppa.action_type = 'B'
;
select 1 into l_dummy from dual
where
not exists
(select 1 from pay_assignment_actions paa
where paa.payroll_action_id = l_payroll_action_id
and paa.assignment_action_id <> l_assignment_action_id)
and not exists
(select 1 from pay_run_results prr
where prr.assignment_action_id = l_assignment_action_id
and not (nvl(prr.element_entry_id, prr.source_id) = p_element_entry_id
and prr.source_type = 'E'));
ROLLBACK TO delete_adjustment;
ROLLBACK TO delete_adjustment;
end delete_adjustment;