DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SHA_SHD

Source


1 Package Body per_sha_shd as
2 /* $Header: pesharhi.pkb 115.6 2002/12/06 16:54:11 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_sha_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'PER_STD_HOLIDAY_ABSENCES_PK') Then
22     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   Else
27     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
28     hr_utility.set_message_token('PROCEDURE', l_proc);
29     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
30     hr_utility.raise_error;
31   End If;
32   --
33   hr_utility.set_location(' Leaving:'||l_proc, 10);
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40   (
41   p_std_holiday_absences_id            in number,
42   p_object_version_number              in number
43   )      Return Boolean Is
44 --
45   --
46   -- Cursor selects the 'current' row from the HR Schema
47   --
48   Cursor C_Sel1 is
49     select
50 	std_holiday_absences_id,
51 	date_not_taken,
52 	person_id,
53 	standard_holiday_id,
54 	actual_date_taken,
55 	reason,
56         expired,
57 	attribute_category,
58 	attribute1,
59 	attribute2,
60 	attribute3,
61 	attribute4,
62 	attribute5,
63 	attribute6,
64 	attribute7,
65 	attribute8,
66 	attribute9,
67 	attribute10,
68 	attribute11,
69 	attribute12,
70 	attribute13,
71 	attribute14,
72 	attribute15,
73 	attribute16,
74 	attribute17,
75 	attribute18,
76 	attribute19,
77 	attribute20,
78 	object_version_number
79     from	per_std_holiday_absences
80     where	std_holiday_absences_id = p_std_holiday_absences_id;
81 --
82   l_proc	varchar2(72)	:= g_package||'api_updating';
83   l_fct_ret	boolean;
84 --
85 Begin
86   hr_utility.set_location('Entering:'||l_proc, 5);
87   --
88   If (
89 	p_std_holiday_absences_id is null and
90 	p_object_version_number is null
91      ) Then
92     --
93     -- One of the primary key arguments is null therefore we must
94     -- set the returning function value to false
95     --
96     l_fct_ret := false;
97   Else
98     If (
99 	p_std_holiday_absences_id = g_old_rec.std_holiday_absences_id and
100 	p_object_version_number = g_old_rec.object_version_number
101        ) Then
102       hr_utility.set_location(l_proc, 10);
103       --
104       -- The g_old_rec is current therefore we must
105       -- set the returning function to true
106       --
107       l_fct_ret := true;
108     Else
109       --
110       -- Select the current row into g_old_rec
111       --
112       Open C_Sel1;
113       Fetch C_Sel1 Into g_old_rec;
114       If C_Sel1%notfound Then
115         Close C_Sel1;
116         --
117         -- The primary key is invalid therefore we must error
118         --
119         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
120         hr_utility.raise_error;
121       End If;
122       Close C_Sel1;
123       If (p_object_version_number <> g_old_rec.object_version_number) Then
124         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
125         hr_utility.raise_error;
126       End If;
127       hr_utility.set_location(l_proc, 15);
128       l_fct_ret := true;
129     End If;
130   End If;
131   hr_utility.set_location(' Leaving:'||l_proc, 20);
132   Return (l_fct_ret);
133 --
134 End api_updating;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |---------------------------------< lck >----------------------------------|
138 -- ----------------------------------------------------------------------------
139 Procedure lck
140   (
141   p_std_holiday_absences_id            in number,
142   p_object_version_number              in number
143   ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147   Cursor C_Sel1 is
148     select 	std_holiday_absences_id,
149 	date_not_taken,
150 	person_id,
151 	standard_holiday_id,
152 	actual_date_taken,
156 	attribute1,
153 	reason,
154         expired,
155 	attribute_category,
157 	attribute2,
158 	attribute3,
159 	attribute4,
160 	attribute5,
161 	attribute6,
162 	attribute7,
163 	attribute8,
164 	attribute9,
165 	attribute10,
166 	attribute11,
167 	attribute12,
168 	attribute13,
169 	attribute14,
170 	attribute15,
171 	attribute16,
172 	attribute17,
173 	attribute18,
174 	attribute19,
175 	attribute20,
176 	object_version_number
177     from	per_std_holiday_absences
178     where	std_holiday_absences_id = p_std_holiday_absences_id
179     for	update nowait;
180 --
181   l_proc	varchar2(72) := g_package||'lck';
182 --
183 Begin
184   hr_utility.set_location('Entering:'||l_proc, 5);
185   --
186   -- Add any mandatory argument checking here:
187   -- Example:
188   -- hr_api.mandatory_arg_error
189   --   (p_api_name       => l_proc,
190   --    p_argument       => 'object_version_number',
191   --    p_argument_value => p_object_version_number);
192   --
193   Open  C_Sel1;
194   Fetch C_Sel1 Into g_old_rec;
195   If C_Sel1%notfound then
196     Close C_Sel1;
197     --
198     -- The primary key is invalid therefore we must error
199     --
200     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
201     hr_utility.raise_error;
202   End If;
203   Close C_Sel1;
204   If (p_object_version_number <> g_old_rec.object_version_number) Then
205         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
206         hr_utility.raise_error;
207       End If;
208 --
209   hr_utility.set_location(' Leaving:'||l_proc, 10);
210 --
211 -- We need to trap the ORA LOCK exception
212 --
213 Exception
214   When HR_Api.Object_Locked then
215     --
216     -- The object is locked therefore we need to supply a meaningful
217     -- error message.
218     --
219     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
220     hr_utility.set_message_token('TABLE_NAME', 'per_std_holiday_absences');
221     hr_utility.raise_error;
222 End lck;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< convert_args >-----------------------------|
226 -- ----------------------------------------------------------------------------
227 Function convert_args
228 	(
229 	p_std_holiday_absences_id       in number,
230 	p_date_not_taken                in date,
231 	p_person_id                     in number,
232 	p_standard_holiday_id           in number,
233 	p_actual_date_taken             in date,
234 	p_reason                        in varchar2,
235         p_expired                       in varchar2,
236 	p_attribute_category            in varchar2,
237 	p_attribute1                    in varchar2,
238 	p_attribute2                    in varchar2,
239 	p_attribute3                    in varchar2,
240 	p_attribute4                    in varchar2,
241 	p_attribute5                    in varchar2,
242 	p_attribute6                    in varchar2,
243 	p_attribute7                    in varchar2,
244 	p_attribute8                    in varchar2,
245 	p_attribute9                    in varchar2,
246 	p_attribute10                   in varchar2,
247 	p_attribute11                   in varchar2,
248 	p_attribute12                   in varchar2,
249 	p_attribute13                   in varchar2,
250 	p_attribute14                   in varchar2,
251 	p_attribute15                   in varchar2,
252 	p_attribute16                   in varchar2,
253 	p_attribute17                   in varchar2,
254 	p_attribute18                   in varchar2,
255 	p_attribute19                   in varchar2,
256 	p_attribute20                   in varchar2,
257 	p_object_version_number         in number
258 	)
259 	Return g_rec_type is
260 --
261   l_rec	  g_rec_type;
262   l_proc  varchar2(72) := g_package||'convert_args';
263 --
264 Begin
265   --
266   hr_utility.set_location('Entering:'||l_proc, 5);
267   --
268   -- Convert arguments into local l_rec structure.
269   --
270   l_rec.std_holiday_absences_id          := p_std_holiday_absences_id;
271   l_rec.date_not_taken                   := p_date_not_taken;
272   l_rec.person_id                        := p_person_id;
273   l_rec.standard_holiday_id              := p_standard_holiday_id;
274   l_rec.actual_date_taken                := p_actual_date_taken;
275   l_rec.reason                           := p_reason;
276   l_rec.expired                          := p_expired;
277   l_rec.attribute_category               := p_attribute_category;
278   l_rec.attribute1                       := p_attribute1;
279   l_rec.attribute2                       := p_attribute2;
280   l_rec.attribute3                       := p_attribute3;
281   l_rec.attribute4                       := p_attribute4;
282   l_rec.attribute5                       := p_attribute5;
283   l_rec.attribute6                       := p_attribute6;
284   l_rec.attribute7                       := p_attribute7;
285   l_rec.attribute8                       := p_attribute8;
286   l_rec.attribute9                       := p_attribute9;
287   l_rec.attribute10                      := p_attribute10;
288   l_rec.attribute11                      := p_attribute11;
289   l_rec.attribute12                      := p_attribute12;
290   l_rec.attribute13                      := p_attribute13;
291   l_rec.attribute14                      := p_attribute14;
292   l_rec.attribute15                      := p_attribute15;
293   l_rec.attribute16                      := p_attribute16;
294   l_rec.attribute17                      := p_attribute17;
295   l_rec.attribute18                      := p_attribute18;
296   l_rec.attribute19                      := p_attribute19;
297   l_rec.attribute20                      := p_attribute20;
298   l_rec.object_version_number            := p_object_version_number;
299   --
300   -- Return the plsql record structure.
301   --
302   hr_utility.set_location(' Leaving:'||l_proc, 10);
303   Return(l_rec);
304 --
305 End convert_args;
306 --
307 end per_sha_shd;