DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PDM_SHD

Source


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