[Home] [Help]
PACKAGE BODY: APPS.BEN_BCI_SHD
Source
1 Package Body ben_bci_shd as
2 /* $Header: bebcirhi.pkb 120.0 2005/05/28 00:35:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bci_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BATCH_BNFT_CERT_INFO_PK') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 Else
42 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45 hr_utility.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (
56 p_batch_benft_cert_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 batch_benft_cert_id,
66 benefit_action_id,
67 person_id,
68 actn_typ_id,
69 typ_cd,
70 enrt_ctfn_recd_dt,
71 object_version_number
72 from ben_batch_bnft_cert_info
73 where batch_benft_cert_id = p_batch_benft_cert_id;
74 --
75 l_proc varchar2(72) := g_package||'api_updating';
76 l_fct_ret boolean;
77 --
78 Begin
79 hr_utility.set_location('Entering:'||l_proc, 5);
80 --
81 If (
82 p_batch_benft_cert_id is null and
83 p_object_version_number is null
84 ) Then
85 --
86 -- One of the primary key arguments is null therefore we must
87 -- set the returning function value to false
88 --
89 l_fct_ret := false;
90 Else
91 If (
92 p_batch_benft_cert_id = g_old_rec.batch_benft_cert_id and
93 p_object_version_number = g_old_rec.object_version_number
94 ) Then
95 hr_utility.set_location(l_proc, 10);
96 --
97 -- The g_old_rec is current therefore we must
98 -- set the returning function to true
99 --
100 l_fct_ret := true;
101 Else
102 --
103 -- Select the current row into g_old_rec
104 --
105 Open C_Sel1;
106 Fetch C_Sel1 Into g_old_rec;
107 If C_Sel1%notfound Then
108 Close C_Sel1;
109 --
110 -- The primary key is invalid therefore we must error
111 --
112 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
113 hr_utility.raise_error;
114 End If;
115 Close C_Sel1;
116 If (p_object_version_number <> g_old_rec.object_version_number) Then
117 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
118 hr_utility.raise_error;
119 End If;
120 hr_utility.set_location(l_proc, 15);
121 l_fct_ret := true;
122 End If;
123 End If;
124 hr_utility.set_location(' Leaving:'||l_proc, 20);
125 Return (l_fct_ret);
126 --
127 End api_updating;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------------< lck >----------------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure lck
133 (
134 p_batch_benft_cert_id in number,
135 p_object_version_number in number
136 ) is
137 --
138 -- Cursor selects the 'current' row from the HR Schema
139 --
140 Cursor C_Sel1 is
141 select batch_benft_cert_id,
142 benefit_action_id,
143 person_id,
144 actn_typ_id,
145 typ_cd,
146 enrt_ctfn_recd_dt,
147 object_version_number
148 from ben_batch_bnft_cert_info
149 where batch_benft_cert_id = p_batch_benft_cert_id
150 for update nowait;
151 --
152 l_proc varchar2(72) := g_package||'lck';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 -- Add any mandatory argument checking here:
158 -- Example:
159 -- hr_api.mandatory_arg_error
160 -- (p_api_name => l_proc,
161 -- p_argument => 'object_version_number',
162 -- p_argument_value => p_object_version_number);
163 --
164 Open C_Sel1;
165 Fetch C_Sel1 Into g_old_rec;
166 If C_Sel1%notfound then
167 Close C_Sel1;
168 --
169 -- The primary key is invalid therefore we must error
170 --
171 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
172 hr_utility.raise_error;
173 End If;
174 Close C_Sel1;
175 If (p_object_version_number <> g_old_rec.object_version_number) Then
176 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
177 hr_utility.raise_error;
178 End If;
179 --
180 hr_utility.set_location(' Leaving:'||l_proc, 10);
181 --
182 -- We need to trap the ORA LOCK exception
183 --
184 Exception
185 When HR_Api.Object_Locked then
186 --
187 -- The object is locked therefore we need to supply a meaningful
188 -- error message.
189 --
190 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
191 hr_utility.set_message_token('TABLE_NAME', 'ben_batch_bnft_cert_info');
192 hr_utility.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199 (
200 p_batch_benft_cert_id in number,
201 p_benefit_action_id in number,
202 p_person_id in number,
203 p_actn_typ_id in number,
204 p_typ_cd in varchar2,
205 p_enrt_ctfn_recd_dt in date,
206 p_object_version_number in number
207 )
208 Return g_rec_type is
209 --
210 l_rec g_rec_type;
211 l_proc varchar2(72) := g_package||'convert_args';
212 --
213 Begin
214 --
215 hr_utility.set_location('Entering:'||l_proc, 5);
216 --
217 -- Convert arguments into local l_rec structure.
218 --
219 l_rec.batch_benft_cert_id := p_batch_benft_cert_id;
220 l_rec.benefit_action_id := p_benefit_action_id;
221 l_rec.person_id := p_person_id;
222 l_rec.actn_typ_id := p_actn_typ_id;
223 l_rec.typ_cd := p_typ_cd;
224 l_rec.enrt_ctfn_recd_dt := p_enrt_ctfn_recd_dt;
225 l_rec.object_version_number := p_object_version_number;
226 --
227 -- Return the plsql record structure.
228 --
229 hr_utility.set_location(' Leaving:'||l_proc, 10);
230 Return(l_rec);
231 --
232 End convert_args;
233 --
234 end ben_bci_shd;