DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TPL_SHD

Source


1 Package Body ota_tpl_shd as
2 /* $Header: ottpl01t.pkb 115.2 99/07/16 00:55:57 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tpl_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 varchar2) 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_PRICE_LISTS_FK1') 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   ElsIf (p_constraint_name = 'OTA_PRICE_LISTS_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'OTA_PRICE_LISTS_UK2') Then
47     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('STEP','15');
50     hr_utility.raise_error;
51   ElsIf (p_constraint_name = 'OTA_TPL_CHECK_DATES_ORDER') Then
52     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('STEP','20');
55     hr_utility.raise_error;
56   ElsIf (p_constraint_name = 'OTA_TPL_DEFAULT_FLAG_CHK') Then
57     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('STEP','25');
60     hr_utility.raise_error;
61   ElsIf (p_constraint_name = 'OTA_TPL_PRICE_LIST_TYPE_CHK') Then
62     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
63     hr_utility.set_message_token('PROCEDURE', l_proc);
64     hr_utility.set_message_token('STEP','30');
65     hr_utility.raise_error;
66   ElsIf (p_constraint_name = 'OTA_TPL_UNIT_PRICE_NOTNULL') Then
67     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
68     hr_utility.set_message_token('PROCEDURE', l_proc);
69     hr_utility.set_message_token('STEP','35');
70     hr_utility.raise_error;
71   ElsIf (p_constraint_name = 'OTA_TPL_UNIT_PRICE_NULL') Then
72     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
73     hr_utility.set_message_token('PROCEDURE', l_proc);
74     hr_utility.set_message_token('STEP','40');
75     hr_utility.raise_error;
76   ElsIf (p_constraint_name = 'OTA_TPL_UNIT_TYPE_NOTNULL') Then
77     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
78     hr_utility.set_message_token('PROCEDURE', l_proc);
79     hr_utility.set_message_token('STEP','45');
80     hr_utility.raise_error;
81   ElsIf (p_constraint_name = 'OTA_TPL_UNIT_TYPE_NULL') Then
82     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
83     hr_utility.set_message_token('PROCEDURE', l_proc);
84     hr_utility.set_message_token('STEP','50');
85     hr_utility.raise_error;
86   ElsIf (p_constraint_name = 'UNIQUE_NAME_WITHIN_BGROUP') Then
87     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
88     hr_utility.set_message_token('PROCEDURE', l_proc);
89     hr_utility.set_message_token('STEP','55');
90     hr_utility.raise_error;
91   Else
92     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
93     hr_utility.set_message_token('PROCEDURE', l_proc);
94     hr_utility.set_message_token('STEP','60');
95     hr_utility.raise_error;
96   End If;
97   --
98   hr_utility.set_location(' Leaving:'||l_proc, 10);
99 End constraint_error;
100 --
101 -- ----------------------------------------------------------------------------
102 -- |-----------------------------< api_updating >-----------------------------|
103 -- ----------------------------------------------------------------------------
104 Function api_updating
105   (
106   p_price_list_id                      in number,
107   p_object_version_number              in number
108   )      Return Boolean Is
109 --
110   --
111   -- Cursor selects the 'current' row from the HR Schema
112   --
113   Cursor C_Sel1 is
114     select
115 		price_list_id,
116 	business_group_id,
117 	currency_code,
118 	default_flag,
119 	name,
120 	object_version_number,
121 	price_list_type,
122 	start_date,
123 	comments,
124 	description,
125 	end_date,
126 	single_unit_price,
127 	training_unit_type,
128 	tpl_information_category,
129 	tpl_information1,
130 	tpl_information2,
131 	tpl_information3,
132 	tpl_information4,
133 	tpl_information5,
134 	tpl_information6,
135 	tpl_information7,
136 	tpl_information8,
137 	tpl_information9,
138 	tpl_information10,
139 	tpl_information11,
140 	tpl_information12,
141 	tpl_information13,
142 	tpl_information14,
143 	tpl_information15,
144 	tpl_information16,
145 	tpl_information17,
146 	tpl_information18,
147 	tpl_information19,
148 	tpl_information20
149     from	ota_price_lists
150     where	price_list_id = p_price_list_id;
151 --
152   l_proc	varchar2(72)	:= g_package||'api_updating';
153   l_fct_ret	boolean;
154 --
155 Begin
156   hr_utility.set_location('Entering:'||l_proc, 5);
157   --
158   If (
159 	p_price_list_id is null and
160 	p_object_version_number is null
161      ) Then
162     --
163     -- One of the primary key arguments is null therefore we must
164     -- set the returning function value to false
165     --
166     l_fct_ret := false;
167   Else
168     If (
169 	p_price_list_id = g_old_rec.price_list_id and
170 	p_object_version_number = g_old_rec.object_version_number
171        ) Then
172       hr_utility.set_location(l_proc, 10);
173       --
174       -- The g_old_rec is current therefore we must
175       -- set the returning function to true
176       --
177       l_fct_ret := true;
178     Else
179       --
180       -- Select the current row into g_old_rec
181       --
182       Open C_Sel1;
183       Fetch C_Sel1 Into g_old_rec;
184       If C_Sel1%notfound Then
185         Close C_Sel1;
186         --
187         -- The primary key is invalid therefore we must error
188         --
189         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
190         hr_utility.raise_error;
191       End If;
192       Close C_Sel1;
193       If (p_object_version_number <> g_old_rec.object_version_number) Then
194         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
195         hr_utility.raise_error;
196       End If;
197       hr_utility.set_location(l_proc, 15);
198       l_fct_ret := true;
199     End If;
200   End If;
201   hr_utility.set_location(' Leaving:'||l_proc, 20);
202   Return (l_fct_ret);
203 --
204 End api_updating;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |---------------------------------< lck >----------------------------------|
208 -- ----------------------------------------------------------------------------
209 Procedure lck
210   (
211   p_price_list_id                      in number,
212   p_object_version_number              in number
213   ) is
214 --
215 -- Cursor selects the 'current' row from the HR Schema
216 --
217   Cursor C_Sel1 is
218     select 	price_list_id,
219 	business_group_id,
220 	currency_code,
221 	default_flag,
222 	name,
223 	object_version_number,
224 	price_list_type,
225 	start_date,
226 	comments,
227 	description,
228 	end_date,
229 	single_unit_price,
230 	training_unit_type,
231 	tpl_information_category,
232 	tpl_information1,
233 	tpl_information2,
234 	tpl_information3,
235 	tpl_information4,
236 	tpl_information5,
237 	tpl_information6,
238 	tpl_information7,
239 	tpl_information8,
240 	tpl_information9,
241 	tpl_information10,
242 	tpl_information11,
243 	tpl_information12,
244 	tpl_information13,
245 	tpl_information14,
246 	tpl_information15,
247 	tpl_information16,
248 	tpl_information17,
249 	tpl_information18,
250 	tpl_information19,
251 	tpl_information20
252     from	ota_price_lists
253     where	price_list_id = p_price_list_id
254     for	update nowait;
255 --
256   l_proc	varchar2(72) := g_package||'lck';
257 --
258 Begin
259   hr_utility.set_location('Entering:'||l_proc, 5);
260   --
261   -- Add any mandatory argument checking here:
262   -- Example:
263   -- hr_api.mandatory_arg_error
264   --   (p_api_name       => l_proc,
265   --    p_argument       => 'object_version_number',
266   --    p_argument_value => p_object_version_number);
267   --
268   Open  C_Sel1;
269   Fetch C_Sel1 Into g_old_rec;
270   If C_Sel1%notfound then
271     Close C_Sel1;
272     --
273     -- The primary key is invalid therefore we must error
274     --
275     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
276     hr_utility.raise_error;
277   End If;
278   Close C_Sel1;
279   If (p_object_version_number <> g_old_rec.object_version_number) Then
280         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
281         hr_utility.raise_error;
282       End If;
283 --
284   hr_utility.set_location(' Leaving:'||l_proc, 10);
285 --
286 -- We need to trap the ORA LOCK exception
287 --
288 Exception
289   When HR_Api.Object_Locked then
290     --
291     -- The object is locked therefore we need to supply a meaningful
292     -- error message.
293     --
294     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
295     hr_utility.set_message_token('TABLE_NAME', 'ota_price_lists');
296     hr_utility.raise_error;
297 End lck;
298 --
299 -- ----------------------------------------------------------------------------
300 -- |-----------------------------< convert_args >-----------------------------|
301 -- ----------------------------------------------------------------------------
302 Function convert_args
303 	(
304 	p_price_list_id                 in number,
305 	p_business_group_id             in number,
306 	p_currency_code                 in varchar2,
307 	p_default_flag                  in varchar2,
308 	p_name                          in varchar2,
309 	p_object_version_number         in number,
310 	p_price_list_type               in varchar2,
311 	p_start_date                    in date,
312 	p_comments                      in varchar2,
313 	p_description                   in varchar2,
314 	p_end_date                      in date,
315 	p_single_unit_price             in number,
319 	p_tpl_information2              in varchar2,
316 	p_training_unit_type            in varchar2,
317 	p_tpl_information_category      in varchar2,
318 	p_tpl_information1              in varchar2,
320 	p_tpl_information3              in varchar2,
321 	p_tpl_information4              in varchar2,
322 	p_tpl_information5              in varchar2,
323 	p_tpl_information6              in varchar2,
324 	p_tpl_information7              in varchar2,
325 	p_tpl_information8              in varchar2,
326 	p_tpl_information9              in varchar2,
327 	p_tpl_information10             in varchar2,
328 	p_tpl_information11             in varchar2,
329 	p_tpl_information12             in varchar2,
330 	p_tpl_information13             in varchar2,
331 	p_tpl_information14             in varchar2,
332 	p_tpl_information15             in varchar2,
333 	p_tpl_information16             in varchar2,
334 	p_tpl_information17             in varchar2,
335 	p_tpl_information18             in varchar2,
336 	p_tpl_information19             in varchar2,
337 	p_tpl_information20             in varchar2
338 	)
339 	Return g_rec_type is
340 --
341   l_rec	  g_rec_type;
342   l_proc  varchar2(72) := g_package||'convert_args';
343 --
344 Begin
345   --
346   hr_utility.set_location('Entering:'||l_proc, 5);
347   --
348   -- Convert arguments into local l_rec structure.
349   --
350   l_rec.price_list_id                    := p_price_list_id;
351   l_rec.business_group_id                := p_business_group_id;
352   l_rec.currency_code                    := p_currency_code;
353   l_rec.default_flag                     := p_default_flag;
354   l_rec.name                             := p_name;
355   l_rec.object_version_number            := p_object_version_number;
356   l_rec.price_list_type                  := p_price_list_type;
357   l_rec.start_date                       := p_start_date;
358   l_rec.comments                         := p_comments;
359   l_rec.description                      := p_description;
360   l_rec.end_date                         := p_end_date;
361   l_rec.single_unit_price                := p_single_unit_price;
362   l_rec.training_unit_type               := p_training_unit_type;
363   l_rec.tpl_information_category         := p_tpl_information_category;
364   l_rec.tpl_information1                 := p_tpl_information1;
365   l_rec.tpl_information2                 := p_tpl_information2;
366   l_rec.tpl_information3                 := p_tpl_information3;
367   l_rec.tpl_information4                 := p_tpl_information4;
368   l_rec.tpl_information5                 := p_tpl_information5;
369   l_rec.tpl_information6                 := p_tpl_information6;
370   l_rec.tpl_information7                 := p_tpl_information7;
371   l_rec.tpl_information8                 := p_tpl_information8;
372   l_rec.tpl_information9                 := p_tpl_information9;
373   l_rec.tpl_information10                := p_tpl_information10;
374   l_rec.tpl_information11                := p_tpl_information11;
375   l_rec.tpl_information12                := p_tpl_information12;
376   l_rec.tpl_information13                := p_tpl_information13;
377   l_rec.tpl_information14                := p_tpl_information14;
378   l_rec.tpl_information15                := p_tpl_information15;
379   l_rec.tpl_information16                := p_tpl_information16;
380   l_rec.tpl_information17                := p_tpl_information17;
381   l_rec.tpl_information18                := p_tpl_information18;
382   l_rec.tpl_information19                := p_tpl_information19;
383   l_rec.tpl_information20                := p_tpl_information20;
384   --
385   -- Return the plsql record structure.
386   --
387   hr_utility.set_location(' Leaving:'||l_proc, 10);
388   Return(l_rec);
389 --
390 End convert_args;
391 --
392 end ota_tpl_shd;