[Home] [Help]
PACKAGE BODY: APPS.OTA_NHS_SHD
Source
1 Package Body ota_nhs_shd as
2 /* $Header: otnhsrhi.pkb 120.2 2011/06/22 09:15:20 smahanka ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_nhs_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
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 = 'OTA_NOTRNG_HISTORIES_PK') Then
37 fnd_message.set_name('OTA', 'OTA_13698_NHS_PRIMARY_KEY');
38 fnd_message.raise_error;
39 Elsif (p_constraint_name = 'OTA_NOTRNG_HISTORIES_FK1') Then
40 fnd_message.set_name('OTA', 'OTA_13699_NHS_FOREIGN_KEY1');
41 fnd_message.raise_error;
42 Elsif (p_constraint_name = 'OTA_NOTRNG_HISTORIES_FK2') Then
43 fnd_message.set_name('OTA', 'OTA_13303_TAV_NOT_EXISTS');
44 fnd_message.raise_error;
45 Elsif (p_constraint_name = 'OTA_NTH_CUSTOMER_ID_NOT_NULL') Then
46 fnd_message.set_name('OTA', 'OTA_13883_NHS_CUS_ORG_EXISTS');
47 fnd_message.raise_error;
48 Elsif (p_constraint_name = 'OTA_NTH_ORGANIZATION_NOT_NULL') Then
49 fnd_message.set_name('OTA', 'OTA_13883_NHS_CUS_ORG_EXISTS');
50 fnd_message.raise_error;
51 Else
52 fnd_message.set_name('OTA', 'OTA_13259_GEN_UNKN_CONSTRAINT');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('CONSTRAINT', p_constraint_name);
55 hr_utility.raise_error;
56 End If;
57 --
58 hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (
66 p_nota_history_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 nota_history_id,
76 person_id,
77 contact_id,
78 trng_title,
79 provider,
80 type,
81 centre,
82 completion_date,
83 award,
84 rating,
85 duration,
86 duration_units,
87 activity_version_id,
88 status,
89 verified_by_id,
90 nth_information_category,
91 nth_information1,
92 nth_information2,
93 nth_information3,
94 nth_information4,
95 nth_information5,
96 nth_information6,
97 nth_information7,
98 nth_information8,
99 nth_information9,
100 nth_information10,
101 nth_information11,
102 nth_information12,
103 nth_information13,
104 nth_information15,
105 nth_information16,
106 nth_information17,
107 nth_information18,
108 nth_information19,
109 nth_information20,
110 org_id,
111 object_version_number,
112 business_group_id,
113 nth_information14,
114 customer_id,
115 organization_id
116 from ota_notrng_histories
117 where nota_history_id = p_nota_history_id;
118 --
119 l_proc varchar2(72) := g_package||'api_updating';
120 l_fct_ret boolean;
121 --
122 Begin
123 hr_utility.set_location('Entering:'||l_proc, 5);
124 --
125 If (
126 p_nota_history_id is null and
127 p_object_version_number is null
128 ) Then
129 --
130 -- One of the primary key arguments is null therefore we must
131 -- set the returning function value to false
132 --
133 l_fct_ret := false;
134 Else
135 If (
136 p_nota_history_id = g_old_rec.nota_history_id and
137 p_object_version_number = g_old_rec.object_version_number
138 ) Then
139 hr_utility.set_location(l_proc, 10);
140 --
141 -- The g_old_rec is current therefore we must
142 -- set the returning function to true
143 --
144 l_fct_ret := true;
145 Else
146 --
147 -- Select the current row into g_old_rec
148 --
149 Open C_Sel1;
150 Fetch C_Sel1 Into g_old_rec;
151 If C_Sel1%notfound Then
152 Close C_Sel1;
153 --
154 -- The primary key is invalid therefore we must error
155 --
156 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
157 hr_utility.raise_error;
158 End If;
159 Close C_Sel1;
160 If (p_object_version_number <> g_old_rec.object_version_number) Then
161 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
162 hr_utility.raise_error;
163 End If;
164 hr_utility.set_location(l_proc, 15);
165 l_fct_ret := true;
166 End If;
167 End If;
171 End api_updating;
168 hr_utility.set_location(' Leaving:'||l_proc, 20);
169 Return (l_fct_ret);
170 --
172 --
173 -- ----------------------------------------------------------------------------
174 -- |---------------------------------< lck >----------------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure lck
177 (
178 p_nota_history_id in number,
179 p_object_version_number in number
180 ) is
181 --
182 -- Cursor selects the 'current' row from the HR Schema
183 --
184 Cursor C_Sel1 is
185 select nota_history_id,
186 person_id,
187 contact_id,
188 trng_title,
189 provider,
190 type,
191 centre,
192 completion_date,
193 award,
194 rating,
195 duration,
196 duration_units,
197 activity_version_id,
198 status,
199 verified_by_id,
200 nth_information_category,
201 nth_information1,
202 nth_information2,
203 nth_information3,
204 nth_information4,
205 nth_information5,
206 nth_information6,
207 nth_information7,
208 nth_information8,
209 nth_information9,
210 nth_information10,
211 nth_information11,
212 nth_information12,
213 nth_information13,
214 nth_information15,
215 nth_information16,
216 nth_information17,
217 nth_information18,
218 nth_information19,
219 nth_information20,
220 org_id,
221 object_version_number,
222 business_group_id,
223 nth_information14,
224 customer_id,
225 organization_id
226 from ota_notrng_histories
227 where nota_history_id = p_nota_history_id
228 for update nowait;
229 --
230 l_proc varchar2(72) := g_package||'lck';
231 --
232 Begin
233 hr_utility.set_location('Entering:'||l_proc, 5);
234 --
235 -- Add any mandatory argument checking here:
236 -- Example:
237 -- hr_api.mandatory_arg_error
238 -- (p_api_name => l_proc,
239 -- p_argument => 'object_version_number',
240 -- p_argument_value => p_object_version_number);
241 --
242 Open C_Sel1;
243 Fetch C_Sel1 Into g_old_rec;
244 If C_Sel1%notfound then
245 Close C_Sel1;
246 --
247 -- The primary key is invalid therefore we must error
248 --
249 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
250 hr_utility.raise_error;
251 End If;
252 Close C_Sel1;
253 If (p_object_version_number <> g_old_rec.object_version_number) Then
254 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
255 hr_utility.raise_error;
256 End If;
257 --
258 hr_utility.set_location(' Leaving:'||l_proc, 10);
259 --
260 -- We need to trap the ORA LOCK exception
261 --
262 Exception
263 When HR_Api.Object_Locked then
264 --
265 -- The object is locked therefore we need to supply a meaningful
266 -- error message.
267 --
268 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
269 hr_utility.set_message_token('TABLE_NAME', 'ota_notrng_histories');
270 hr_utility.raise_error;
271 End lck;
272 --
273 -- ----------------------------------------------------------------------------
274 -- |-----------------------------< convert_args >-----------------------------|
275 -- ----------------------------------------------------------------------------
276 Function convert_args
277 (
278 p_nota_history_id in number,
279 p_person_id in number,
280 p_contact_id in number,
281 p_trng_title in varchar2,
282 p_provider in varchar2,
283 p_type in varchar2,
284 p_centre in varchar2,
285 p_completion_date in date,
286 p_award in varchar2,
287 p_rating in varchar2,
288 p_duration in number,
289 p_duration_units in varchar2,
290 p_activity_version_id in number,
291 p_status in varchar2,
292 p_verified_by_id in number,
293 p_nth_information_category in varchar2,
294 p_nth_information1 in varchar2,
295 p_nth_information2 in varchar2,
296 p_nth_information3 in varchar2,
297 p_nth_information4 in varchar2,
298 p_nth_information5 in varchar2,
299 p_nth_information6 in varchar2,
300 p_nth_information7 in varchar2,
301 p_nth_information8 in varchar2,
302 p_nth_information9 in varchar2,
303 p_nth_information10 in varchar2,
304 p_nth_information11 in varchar2,
305 p_nth_information12 in varchar2,
306 p_nth_information13 in varchar2,
307 p_nth_information15 in varchar2,
308 p_nth_information16 in varchar2,
309 p_nth_information17 in varchar2,
310 p_nth_information18 in varchar2,
311 p_nth_information19 in varchar2,
312 p_nth_information20 in varchar2,
313 p_org_id in number,
314 p_object_version_number in number,
315 p_business_group_id in number,
316 p_nth_information14 in varchar2,
317 p_customer_id in number,
318 p_organization_id in number
319 )
320 Return g_rec_type is
321 --
322 l_rec g_rec_type;
323 l_proc varchar2(72) := g_package||'convert_args';
324 --
325 Begin
326 --
327 hr_utility.set_location('Entering:'||l_proc, 5);
328 --
329 -- Convert arguments into local l_rec structure.
330 --
331 l_rec.nota_history_id := p_nota_history_id;
332 l_rec.person_id := p_person_id;
333 l_rec.contact_id := p_contact_id;
334 l_rec.trng_title := p_trng_title;
335 l_rec.provider := p_provider;
336 l_rec.type := p_type;
337 l_rec.centre := p_centre;
338 l_rec.completion_date := p_completion_date;
339 l_rec.award := p_award;
340 l_rec.rating := p_rating;
341 l_rec.duration := p_duration;
342 l_rec.duration_units := p_duration_units;
343 l_rec.activity_version_id := p_activity_version_id;
344 l_rec.status := p_status;
345 l_rec.verified_by_id := p_verified_by_id;
346 l_rec.nth_information_category := p_nth_information_category;
347 l_rec.nth_information1 := p_nth_information1;
348 l_rec.nth_information2 := p_nth_information2;
349 l_rec.nth_information3 := p_nth_information3;
350 l_rec.nth_information4 := p_nth_information4;
351 l_rec.nth_information5 := p_nth_information5;
352 l_rec.nth_information6 := p_nth_information6;
353 l_rec.nth_information7 := p_nth_information7;
354 l_rec.nth_information8 := p_nth_information8;
355 l_rec.nth_information9 := p_nth_information9;
356 l_rec.nth_information10 := p_nth_information10;
357 l_rec.nth_information11 := p_nth_information11;
358 l_rec.nth_information12 := p_nth_information12;
359 l_rec.nth_information13 := p_nth_information13;
360 l_rec.nth_information15 := p_nth_information15;
361 l_rec.nth_information16 := p_nth_information16;
362 l_rec.nth_information17 := p_nth_information17;
363 l_rec.nth_information18 := p_nth_information18;
364 l_rec.nth_information19 := p_nth_information19;
365 l_rec.nth_information20 := p_nth_information20;
366 l_rec.org_id := p_org_id;
367 l_rec.object_version_number := p_object_version_number;
368 l_rec.business_group_id := p_business_group_id;
369 l_rec.nth_information14 := p_nth_information14;
370 l_rec.customer_id := p_customer_id;
371 l_rec.organization_id := p_organization_id;
372 --
373 -- Return the plsql record structure.
374 --
375 hr_utility.set_location(' Leaving:'||l_proc, 10);
376 Return(l_rec);
377 --
378 End convert_args;
379 --
380 end ota_nhs_shd;