1 package body ben_element_delete_check as
2 /* $Header: beneedck.pkb 115.4 2003/02/05 19:27:43 mmudigon noship $ */
3 procedure check_element_delete(p_element_entry_id IN NUMBER) is
4 --
5 -- This cursor checks that there are no rates
6 -- that are attached to the same element we are trying to
7 -- delete the element entry for.
8 -- If element entry is for a rate, error condition is thrown
9 --
10 cursor c_abr is
11 select 1
12 from ben_acty_base_rt_f
13 where element_type_id in
14 (select el.element_type_id
15 from pay_element_entries_f ee
16 , pay_element_links_f el
17 where el.element_link_id = ee.element_link_id
18 and ee.element_entry_id = p_element_entry_id
19 --Bug 2673501 fixes added this to see if it is creation by benefits process.
20 --We show this error for the rows created by the benefits process.
21 and ee.creator_id in
22 ( select pen.prtt_enrt_rslt_id
23 from ben_prtt_enrt_rslt_f pen ));
24 l_temp number;
25 begin
26 open c_abr;
27 fetch c_abr into l_temp;
28 if c_abr%FOUND then
29 close c_abr;
30 fnd_message.set_name('BEN','BEN_93109_ELEMENT_USED_BY_RT');
31 fnd_message.raise_error;
32 else
33 close c_abr;
34 end if;
35 end check_element_delete;
36 end ben_element_delete_check;