[Home] [Help]
PACKAGE BODY: APPS.PER_ECO_SHD
Source
1 Package Body per_eco_shd as
2 /* $Header: peecorhi.pkb 115.7 2002/12/05 10:37:50 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_eco_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
30 ) Is
31 --
32 l_proc varchar2(72) := g_package||'constraint_error';
33 --
34 Begin
35 --
36 If (p_constraint_name = 'PER_ELECTION_CONSTITUENCYS_FK2') Then
37 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('STEP','5');
40 fnd_message.raise_error;
41 ElsIf (p_constraint_name = 'PER_ELECTION_CONSTITUENCYS_FK3') Then
42 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('STEP','10');
45 fnd_message.raise_error;
46 ElsIf (p_constraint_name = 'PER_ELECTION_CONSTITUENCYS_PK') Then
47 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('STEP','15');
50 fnd_message.raise_error;
51 Else
52 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55 fnd_message.raise_error;
56 End If;
57 --
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64 (p_election_constituency_id in number
65 ,p_object_version_number in number
66 )
67 Return Boolean Is
68 --
69 --
70 -- Cursor selects the 'current' row from the HR Schema
71 --
72 Cursor C_Sel1 is
73 select
74 election_constituency_id
75 ,election_id
76 ,business_group_id
77 ,constituency_id
78 ,attribute_category
79 ,attribute1
80 ,attribute2
81 ,attribute3
82 ,attribute4
83 ,attribute5
84 ,attribute6
85 ,attribute7
86 ,attribute8
87 ,attribute9
88 ,attribute10
89 ,attribute11
90 ,attribute12
91 ,attribute13
92 ,attribute14
93 ,attribute15
94 ,attribute16
95 ,attribute17
96 ,attribute18
97 ,attribute19
98 ,attribute20
99 ,attribute21
100 ,attribute22
101 ,attribute23
102 ,attribute24
103 ,attribute25
104 ,attribute26
105 ,attribute27
106 ,attribute28
107 ,attribute29
108 ,attribute30
109 ,object_version_number
110 from per_election_constituencys
111 where election_constituency_id = p_election_constituency_id;
112 --
113 l_fct_ret boolean;
114 --
115 Begin
116 --
117 If (p_election_constituency_id is null and
118 p_object_version_number is null
119 ) Then
120 --
121 -- One of the primary key arguments is null therefore we must
122 -- set the returning function value to false
123 --
124 l_fct_ret := false;
125 Else
126 If (p_election_constituency_id
127 = per_eco_shd.g_old_rec.election_constituency_id and
128 p_object_version_number
129 = per_eco_shd.g_old_rec.object_version_number
130 ) Then
131 --
132 -- The g_old_rec is current therefore we must
133 -- set the returning function to true
134 --
135 l_fct_ret := true;
136 Else
137 --
138 -- Select the current row into g_old_rec
139 --
140 Open C_Sel1;
141 Fetch C_Sel1 Into per_eco_shd.g_old_rec;
142 If C_Sel1%notfound Then
143 Close C_Sel1;
144 --
145 -- The primary key is invalid therefore we must error
146 --
147 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
148 fnd_message.raise_error;
149 End If;
150 Close C_Sel1;
151 If (p_object_version_number
152 <> per_eco_shd.g_old_rec.object_version_number) Then
153 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
154 fnd_message.raise_error;
155 End If;
156 l_fct_ret := true;
157 End If;
158 End If;
159 Return (l_fct_ret);
160 --
161 End api_updating;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |---------------------------------< lck >----------------------------------|
165 -- ----------------------------------------------------------------------------
166 Procedure lck
167 (p_election_constituency_id in number
168 ,p_object_version_number in number
169 ) is
170 --
171 -- Cursor selects the 'current' row from the HR Schema
172 --
173 Cursor C_Sel1 is
174 select
175 election_constituency_id
176 ,election_id
177 ,business_group_id
178 ,constituency_id
179 ,attribute_category
180 ,attribute1
181 ,attribute2
182 ,attribute3
183 ,attribute4
184 ,attribute5
185 ,attribute6
186 ,attribute7
187 ,attribute8
188 ,attribute9
189 ,attribute10
190 ,attribute11
191 ,attribute12
192 ,attribute13
193 ,attribute14
194 ,attribute15
195 ,attribute16
196 ,attribute17
197 ,attribute18
198 ,attribute19
199 ,attribute20
200 ,attribute21
201 ,attribute22
202 ,attribute23
203 ,attribute24
204 ,attribute25
205 ,attribute26
206 ,attribute27
207 ,attribute28
208 ,attribute29
209 ,attribute30
210 ,object_version_number
211 from per_election_constituencys
212 where election_constituency_id = p_election_constituency_id
213 for update nowait;
214 --
215 l_proc varchar2(72) := g_package||'lck';
216 --
217 Begin
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220 hr_api.mandatory_arg_error
221 (p_api_name => l_proc
222 ,p_argument => 'ELECTION_CONSTITUENCY_ID'
223 ,p_argument_value => p_election_constituency_id
224 );
225 --
226 Open C_Sel1;
227 Fetch C_Sel1 Into per_eco_shd.g_old_rec;
228 If C_Sel1%notfound then
229 Close C_Sel1;
230 --
231 -- The primary key is invalid therefore we must error
232 --
233 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
234 fnd_message.raise_error;
235 End If;
236 Close C_Sel1;
237 If (p_object_version_number
238 <> per_eco_shd.g_old_rec.object_version_number) Then
239 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
240 fnd_message.raise_error;
241 End If;
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 --
245 -- We need to trap the ORA LOCK exception
246 --
247 Exception
248 When HR_Api.Object_Locked then
249 --
250 -- The object is locked therefore we need to supply a meaningful
251 -- error message.
252 --
253 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
254 fnd_message.set_token('TABLE_NAME', 'per_election_constituencys');
255 fnd_message.raise_error;
256 End lck;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |-----------------------------< convert_args >-----------------------------|
260 -- ----------------------------------------------------------------------------
261 Function convert_args
262 (p_election_constituency_id in number
263 ,p_election_id in number
264 ,p_business_group_id in number
265 ,p_constituency_id in number
266 ,p_attribute_category in varchar2
267 ,p_attribute1 in varchar2
268 ,p_attribute2 in varchar2
269 ,p_attribute3 in varchar2
270 ,p_attribute4 in varchar2
271 ,p_attribute5 in varchar2
272 ,p_attribute6 in varchar2
273 ,p_attribute7 in varchar2
274 ,p_attribute8 in varchar2
275 ,p_attribute9 in varchar2
276 ,p_attribute10 in varchar2
277 ,p_attribute11 in varchar2
278 ,p_attribute12 in varchar2
279 ,p_attribute13 in varchar2
280 ,p_attribute14 in varchar2
281 ,p_attribute15 in varchar2
282 ,p_attribute16 in varchar2
283 ,p_attribute17 in varchar2
284 ,p_attribute18 in varchar2
285 ,p_attribute19 in varchar2
286 ,p_attribute20 in varchar2
287 ,p_attribute21 in varchar2
288 ,p_attribute22 in varchar2
289 ,p_attribute23 in varchar2
290 ,p_attribute24 in varchar2
291 ,p_attribute25 in varchar2
292 ,p_attribute26 in varchar2
293 ,p_attribute27 in varchar2
294 ,p_attribute28 in varchar2
295 ,p_attribute29 in varchar2
296 ,p_attribute30 in varchar2
297 ,p_object_version_number in number
298 )
299 Return g_rec_type is
300 --
301 l_rec g_rec_type;
302 --
303 Begin
304 --
305 -- Convert arguments into local l_rec structure.
306 --
307 l_rec.election_constituency_id := p_election_constituency_id;
308 l_rec.election_id := p_election_id;
309 l_rec.business_group_id := p_business_group_id;
310 l_rec.constituency_id := p_constituency_id;
311 l_rec.attribute_category := p_attribute_category;
312 l_rec.attribute1 := p_attribute1;
313 l_rec.attribute2 := p_attribute2;
314 l_rec.attribute3 := p_attribute3;
315 l_rec.attribute4 := p_attribute4;
316 l_rec.attribute5 := p_attribute5;
317 l_rec.attribute6 := p_attribute6;
318 l_rec.attribute7 := p_attribute7;
319 l_rec.attribute8 := p_attribute8;
320 l_rec.attribute9 := p_attribute9;
321 l_rec.attribute10 := p_attribute10;
322 l_rec.attribute11 := p_attribute11;
323 l_rec.attribute12 := p_attribute12;
324 l_rec.attribute13 := p_attribute13;
325 l_rec.attribute14 := p_attribute14;
326 l_rec.attribute15 := p_attribute15;
327 l_rec.attribute16 := p_attribute16;
328 l_rec.attribute17 := p_attribute17;
329 l_rec.attribute18 := p_attribute18;
330 l_rec.attribute19 := p_attribute19;
331 l_rec.attribute20 := p_attribute20;
332 l_rec.attribute21 := p_attribute21;
333 l_rec.attribute22 := p_attribute22;
334 l_rec.attribute23 := p_attribute23;
335 l_rec.attribute24 := p_attribute24;
336 l_rec.attribute25 := p_attribute25;
337 l_rec.attribute26 := p_attribute26;
338 l_rec.attribute27 := p_attribute27;
339 l_rec.attribute28 := p_attribute28;
340 l_rec.attribute29 := p_attribute29;
341 l_rec.attribute30 := p_attribute30;
342 l_rec.object_version_number := p_object_version_number;
343 --
344 -- Return the plsql record structure.
345 --
346 Return(l_rec);
347 --
348 End convert_args;
349 --
350 end per_eco_shd;