DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_EST_SHD

Source


1 Package Body per_est_shd as
2 /* $Header: peestrhi.pkb 120.0.12010000.2 2008/11/28 11:06:53 ppentapa ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_est_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 = 'PER_ESTABLISHMENTS_PK') Then
37     hr_utility.set_message(800,'HR_51492_ESA_ESTAB_ID_PK ');
38     hr_utility.raise_error;
39   Elsif (p_constraint_name = 'PER_ESTABLISHMENTS_UK') Then
40     hr_utility.set_message(801, 'HR_51485_EST_NAME_LOCAT_UNIQUE');
44     hr_utility.set_message_token('PROCEDURE', l_proc);
41     hr_utility.raise_error;
42   Else
43     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
45     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
46     hr_utility.raise_error;
47   End If;
48   --
49   hr_utility.set_location(' Leaving:'||l_proc, 10);
50 End constraint_error;
51 --
52 -- ----------------------------------------------------------------------------
53 -- |-----------------------------< api_updating >-----------------------------|
54 -- ----------------------------------------------------------------------------
55 Function api_updating
56   (
57   p_establishment_id                   in number,
58   p_object_version_number              in number
59   )      Return Boolean Is
60 --
61   --
62   -- Cursor selects the 'current' row from the HR Schema
63   --
64   Cursor C_Sel1 is
65     select
66 	establishment_id,
67 	name,
68 	location,
69 	attribute_category,
70 	attribute1,
71 	attribute2,
72 	attribute3,
73 	attribute4,
74 	attribute5,
75 	attribute6,
76 	attribute7,
77 	attribute8,
78 	attribute9,
79 	attribute10,
80 	attribute11,
81 	attribute12,
82 	attribute13,
83 	attribute14,
84 	attribute15,
85 	attribute16,
86 	attribute17,
87 	attribute18,
88 	attribute19,
89 	attribute20,
90 	est_information_category,
91 	est_information1,
92 	est_information2,
93 	est_information3,
94 	est_information4,
95 	est_information5,
96 	est_information6,
97 	est_information7,
98 	est_information8,
99 	est_information9,
100 	est_information10,
101 	est_information11,
102 	est_information12,
103 	est_information13,
104 	est_information14,
105 	est_information15,
106 	est_information16,
107 	est_information17,
108 	est_information18,
109 	est_information19,
110 	est_information20 ,
111 	object_version_number
112     from	per_establishments
113     where	establishment_id = p_establishment_id;
114 --
115   l_proc	varchar2(72)	:= g_package||'api_updating';
116   l_fct_ret	boolean;
117 --
118 Begin
119   hr_utility.set_location('Entering:'||l_proc, 5);
120   --
121   If (
122 	p_establishment_id is null and
123 	p_object_version_number is null
124      ) Then
125     --
126     -- One of the primary key arguments is null therefore we must
127     -- set the returning function value to false
128     --
129     l_fct_ret := false;
130   Else
131     If (
132 	p_establishment_id = g_old_rec.establishment_id and
133 	p_object_version_number = g_old_rec.object_version_number
134        ) Then
135       hr_utility.set_location(l_proc, 10);
136       --
137       -- The g_old_rec is current therefore we must
138       -- set the returning function to true
139       --
140       l_fct_ret := true;
141     Else
142       --
143       -- Select the current row into g_old_rec
144       --
145       Open C_Sel1;
146       Fetch C_Sel1 Into g_old_rec;
147       If C_Sel1%notfound Then
148         Close C_Sel1;
149         --
150         -- The primary key is invalid therefore we must error
151         --
152         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
153         hr_utility.raise_error;
154       End If;
155       Close C_Sel1;
156       If (p_object_version_number <> g_old_rec.object_version_number) Then
157         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
158         hr_utility.raise_error;
159       End If;
160       hr_utility.set_location(l_proc, 15);
161       l_fct_ret := true;
162     End If;
163   End If;
164   hr_utility.set_location(' Leaving:'||l_proc, 20);
165   Return (l_fct_ret);
166 --
167 End api_updating;
168 --
169 -- ----------------------------------------------------------------------------
170 -- |---------------------------------< lck >----------------------------------|
171 -- ----------------------------------------------------------------------------
172 Procedure lck
173   (
174   p_establishment_id                   in number,
175   p_object_version_number              in number
176   ) is
177 --
178 -- Cursor selects the 'current' row from the HR Schema
179 --
180   Cursor C_Sel1 is
181     select 	establishment_id,
182 	name,
183 	location,
184 	attribute_category,
185 	attribute1,
186 	attribute2,
187 	attribute3,
188 	attribute4,
189 	attribute5,
190 	attribute6,
191 	attribute7,
192 	attribute8,
193 	attribute9,
194 	attribute10,
195 	attribute11,
196 	attribute12,
197 	attribute13,
198 	attribute14,
199 	attribute15,
200 	attribute16,
201 	attribute17,
202 	attribute18,
203 	attribute19,
204 	attribute20,
205 	est_information_category,
206 	est_information1,
207 	est_information2,
208 	est_information3,
209 	est_information4,
210 	est_information5,
211 	est_information6,
212 	est_information7,
213 	est_information8,
214 	est_information9,
215 	est_information10,
216 	est_information11,
217 	est_information12,
218 	est_information13,
219 	est_information14,
220 	est_information15,
221 	est_information16,
222 	est_information17,
223 	est_information18,
224 	est_information19,
225 	est_information20,
229     for	update nowait;
226 	object_version_number
227     from	per_establishments
228     where	establishment_id = p_establishment_id
230 --
231   l_proc	varchar2(72) := g_package||'lck';
232 --
233 Begin
234   hr_utility.set_location('Entering:'||l_proc, 5);
235   --
236   -- Add any mandatory argument checking here:
237   -- Example:
238   -- hr_api.mandatory_arg_error
239   --   (p_api_name       => l_proc,
240   --    p_argument       => 'object_version_number',
241   --    p_argument_value => p_object_version_number);
242   --
243   Open  C_Sel1;
244   Fetch C_Sel1 Into g_old_rec;
245   If C_Sel1%notfound then
246     Close C_Sel1;
247     --
248     -- The primary key is invalid therefore we must error
249     --
250     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
251     hr_utility.raise_error;
252   End If;
253   Close C_Sel1;
254   If (p_object_version_number <> g_old_rec.object_version_number) Then
255         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
256         hr_utility.raise_error;
257       End If;
258 --
259   hr_utility.set_location(' Leaving:'||l_proc, 10);
260 --
261 -- We need to trap the ORA LOCK exception
262 --
263 Exception
264   When HR_Api.Object_Locked then
265     --
266     -- The object is locked therefore we need to supply a meaningful
267     -- error message.
268     --
269     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
270     hr_utility.set_message_token('TABLE_NAME', 'per_establishments');
271     hr_utility.raise_error;
272 End lck;
273 --
274 -- ----------------------------------------------------------------------------
275 -- |-----------------------------< convert_args >-----------------------------|
276 -- ----------------------------------------------------------------------------
277 Function convert_args
278 	(
279 	p_establishment_id              in number,
280 	p_name                          in varchar2,
281 	p_location                      in varchar2,
282 	p_attribute_category      in varchar2,
283 	p_attribute1              in varchar2,
284 	p_attribute2              in varchar2,
285 	p_attribute3              in varchar2,
286 	p_attribute4              in varchar2,
287 	p_attribute5              in varchar2,
288 	p_attribute6              in varchar2,
289 	p_attribute7              in varchar2,
290 	p_attribute8              in varchar2,
291 	p_attribute9              in varchar2,
292 	p_attribute10             in varchar2,
293 	p_attribute11             in varchar2,
294 	p_attribute12             in varchar2,
295 	p_attribute13             in varchar2,
296 	p_attribute14             in varchar2,
297 	p_attribute15             in varchar2,
298 	p_attribute16             in varchar2,
299 	p_attribute17             in varchar2,
300 	p_attribute18             in varchar2,
301 	p_attribute19             in varchar2,
302 	p_attribute20             in varchar2,
303 	p_est_information_category            in varchar2,
304 	p_est_information1                    in varchar2,
305 	p_est_information2                    in varchar2,
306 	p_est_information3                    in varchar2,
307 	p_est_information4                    in varchar2,
308 	p_est_information5                    in varchar2,
309 	p_est_information6                    in varchar2,
310 	p_est_information7                    in varchar2,
311 	p_est_information8                    in varchar2,
312 	p_est_information9                    in varchar2,
313 	p_est_information10                   in varchar2,
314 	p_est_information11                   in varchar2,
315 	p_est_information12                   in varchar2,
316 	p_est_information13                   in varchar2,
317 	p_est_information14                   in varchar2,
318 	p_est_information15                   in varchar2,
319 	p_est_information16                   in varchar2,
320 	p_est_information17                   in varchar2,
321 	p_est_information18                   in varchar2,
322 	p_est_information19                   in varchar2,
323 	p_est_information20                   in varchar2,
324 	p_object_version_number         in number
325 	)
326 	Return g_rec_type is
327 --
328   l_rec	  g_rec_type;
329   l_proc  varchar2(72) := g_package||'convert_args';
330 --
331 Begin
332   --
333   hr_utility.set_location('Entering:'||l_proc, 5);
334   --
335   -- Convert arguments into local l_rec structure.
336   --
337   l_rec.establishment_id                 := p_establishment_id;
338   l_rec.name                             := p_name;
339   l_rec.location                         := p_location;
340   l_rec.attribute_category         := p_attribute_category;
341   l_rec.attribute1                 := p_attribute1;
342   l_rec.attribute2                 := p_attribute2;
343   l_rec.attribute3                 := p_attribute3;
344   l_rec.attribute4                 := p_attribute4;
345   l_rec.attribute5                 := p_attribute5;
346   l_rec.attribute6                 := p_attribute6;
347   l_rec.attribute7                 := p_attribute7;
348   l_rec.attribute8                 := p_attribute8;
349   l_rec.attribute9                 := p_attribute9;
350   l_rec.attribute10                := p_attribute10;
351   l_rec.attribute11                := p_attribute11;
352   l_rec.attribute12                := p_attribute12;
353   l_rec.attribute13                := p_attribute13;
354   l_rec.attribute14                := p_attribute14;
355   l_rec.attribute15                := p_attribute15;
356   l_rec.attribute16                := p_attribute16;
357   l_rec.attribute17                := p_attribute17;
358   l_rec.attribute18                := p_attribute18;
359   l_rec.attribute19                := p_attribute19;
360   l_rec.attribute20                := p_attribute20;
361   l_rec.est_information_category               := p_est_information_category;
362   l_rec.est_information1                       := p_est_information1;
363   l_rec.est_information2                       := p_est_information2;
364   l_rec.est_information3                       := p_est_information3;
365   l_rec.est_information4                       := p_est_information4;
366   l_rec.est_information5                       := p_est_information5;
367   l_rec.est_information6                       := p_est_information6;
368   l_rec.est_information7                       := p_est_information7;
369   l_rec.est_information8                       := p_est_information8;
370   l_rec.est_information9                       := p_est_information9;
371   l_rec.est_information10                      := p_est_information10;
372   l_rec.est_information11                      := p_est_information11;
373   l_rec.est_information12                      := p_est_information12;
374   l_rec.est_information13                      := p_est_information13;
375   l_rec.est_information14                      := p_est_information14;
376   l_rec.est_information15                      := p_est_information15;
377   l_rec.est_information16                      := p_est_information16;
378   l_rec.est_information17                      := p_est_information17;
379   l_rec.est_information18                      := p_est_information18;
380   l_rec.est_information19                      := p_est_information19;
381   l_rec.est_information20                      := p_est_information20;
382   l_rec.object_version_number            := p_object_version_number;
383   --
384   -- Return the plsql record structure.
385   --
386   hr_utility.set_location(' Leaving:'||l_proc, 10);
387   Return(l_rec);
388 --
389 End convert_args;
390 --
391 end per_est_shd;