The following lines contain the word 'select', 'insert', 'update' or 'delete':
procedure PARENT_DELETED (
--
--***************************************************************************
--* Handles the case when a referenced master entity has one of its records *
--* deleted or shut down *
--***************************************************************************
--
-- Parameters are:
--
-- Identifier of parent record
p_parent_id number,
--
p_delete_mode varchar2 default 'DELETE',
p_session_date date default trunc(sysdate),
--
-- Name of parent entity from which a deletion has been made
p_parent_name varchar2
--
) is
--
cursor csr_orphaned_rows is
--
/* Returns the set of rows whose foreign key references
the deleted record. The decode determines which
foreign key is used, thus the cursor applies to any
parent entity. */
--
select *
from ben_benefit_contributions_f
where p_parent_id = decode (p_parent_name,
'PAY_ELEMENT_TYPES_F', element_type_id,
'PER_BUSINESS_GROUPS', business_group_id,
'PER_COBRA_COVERAGE_BENEFITS_F',coverage_type)
for update;
if p_delete_mode = 'ZAP'
or (p_delete_mode = 'DELETE'
and p_session_date < fetched_benefit_contribution.effective_start_date )
then
--
delete from ben_benefit_contributions_f
where current of csr_orphaned_rows;
elsif (p_delete_mode = 'DELETE'
and p_session_date between fetched_benefit_contribution.effective_start_date
and fetched_benefit_contribution.effective_end_date)
then
--
update ben_benefit_contributions_f
set effective_end_date = p_session_date
where current of csr_orphaned_rows;
end parent_deleted;