[Home] [Help]
PACKAGE BODY: APPS.PQH_PLG_SHD
Source
1 Package Body pqh_plg_shd as
2 /* $Header: pqplgrhi.pkb 115.5 2002/12/12 23:13:49 sgoyal ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_plg_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'PQH_PROCESS_LOG_FK1') Then
23 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
24 hr_utility.set_message_token('PROCEDURE', l_proc);
25 hr_utility.set_message_token('STEP','5');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'PQH_PROCESS_LOG_FK2') Then
28 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','10');
31 hr_utility.raise_error;
32 Else
33 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
36 hr_utility.raise_error;
37 End If;
38 --
39 hr_utility.set_location(' Leaving:'||l_proc, 10);
40 End constraint_error;
41 --
42 -- ----------------------------------------------------------------------------
43 -- |-----------------------------< api_updating >-----------------------------|
44 -- ----------------------------------------------------------------------------
45 Function api_updating
46 (
47 p_process_log_id in number,
48 p_object_version_number in number
49 ) Return Boolean Is
50 --
51 --
52 -- Cursor selects the 'current' row from the HR Schema
53 --
54 Cursor C_Sel1 is
55 select
56 process_log_id,
57 module_cd,
58 txn_id,
59 master_process_log_id,
60 message_text,
61 message_type_cd,
62 batch_status,
63 batch_start_date,
64 batch_end_date,
65 txn_table_route_id,
66 log_context,
67 information_category,
68 information1,
69 information2,
70 information3,
71 information4,
72 information5,
73 information6,
74 information7,
75 information8,
76 information9,
77 information10,
78 information11,
79 information12,
80 information13,
81 information14,
82 information15,
83 information16,
84 information17,
85 information18,
86 information19,
87 information20,
88 information21,
89 information22,
90 information23,
91 information24,
92 information25,
93 information26,
94 information27,
95 information28,
96 information29,
97 information30,
98 object_version_number
99 from pqh_process_log
100 where process_log_id = p_process_log_id;
101 --
102 l_proc varchar2(72) := g_package||'api_updating';
103 l_fct_ret boolean;
104 --
105 Begin
106 hr_utility.set_location('Entering:'||l_proc, 5);
107 --
108 If (
109 p_process_log_id is null and
110 p_object_version_number is null
111 ) Then
112 --
113 -- One of the primary key arguments is null therefore we must
114 -- set the returning function value to false
115 --
116 l_fct_ret := false;
117 Else
118 If (
119 p_process_log_id = g_old_rec.process_log_id and
120 p_object_version_number = g_old_rec.object_version_number
121 ) Then
122 hr_utility.set_location(l_proc, 10);
123 --
124 -- The g_old_rec is current therefore we must
125 -- set the returning function to true
126 --
127 l_fct_ret := true;
128 Else
129 --
130 -- Select the current row into g_old_rec
131 --
132 Open C_Sel1;
133 Fetch C_Sel1 Into g_old_rec;
134 If C_Sel1%notfound Then
135 Close C_Sel1;
136 --
137 -- The primary key is invalid therefore we must error
138 --
139 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
140 hr_utility.raise_error;
141 End If;
142 Close C_Sel1;
143 If (p_object_version_number <> g_old_rec.object_version_number) Then
144 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
145 hr_utility.raise_error;
146 End If;
147 hr_utility.set_location(l_proc, 15);
148 l_fct_ret := true;
149 End If;
150 End If;
151 hr_utility.set_location(' Leaving:'||l_proc, 20);
152 Return (l_fct_ret);
153 --
154 End api_updating;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |---------------------------------< lck >----------------------------------|
158 -- ----------------------------------------------------------------------------
159 Procedure lck
160 (
161 p_process_log_id in number,
162 p_object_version_number in number
163 ) is
164 --
165 -- Cursor selects the 'current' row from the HR Schema
166 --
167 Cursor C_Sel1 is
168 select process_log_id,
169 module_cd,
170 txn_id,
171 master_process_log_id,
172 message_text,
173 message_type_cd,
174 batch_status,
175 batch_start_date,
176 batch_end_date,
177 txn_table_route_id,
178 log_context,
179 information_category,
180 information1,
181 information2,
182 information3,
183 information4,
184 information5,
185 information6,
186 information7,
187 information8,
188 information9,
189 information10,
190 information11,
191 information12,
192 information13,
193 information14,
194 information15,
195 information16,
196 information17,
197 information18,
198 information19,
199 information20,
200 information21,
201 information22,
202 information23,
203 information24,
204 information25,
205 information26,
206 information27,
207 information28,
208 information29,
209 information30,
210 object_version_number
211 from pqh_process_log
212 where process_log_id = p_process_log_id
213 for update nowait;
214 --
215 l_proc varchar2(72) := g_package||'lck';
216 --
217 Begin
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220 -- Add any mandatory argument checking here:
221 -- Example:
222 -- hr_api.mandatory_arg_error
223 -- (p_api_name => l_proc,
224 -- p_argument => 'object_version_number',
225 -- p_argument_value => p_object_version_number);
226 --
227 Open C_Sel1;
228 Fetch C_Sel1 Into g_old_rec;
229 If C_Sel1%notfound then
230 Close C_Sel1;
231 --
232 -- The primary key is invalid therefore we must error
233 --
234 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
235 hr_utility.raise_error;
236 End If;
237 Close C_Sel1;
238 If (p_object_version_number <> g_old_rec.object_version_number) Then
239 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
240 hr_utility.raise_error;
241 End If;
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 --
245 -- We need to trap the ORA LOCK exception
246 --
247 Exception
248 When HR_Api.Object_Locked then
249 --
250 -- The object is locked therefore we need to supply a meaningful
251 -- error message.
252 --
253 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
254 hr_utility.set_message_token('TABLE_NAME', 'pqh_process_log');
255 hr_utility.raise_error;
256 End lck;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |-----------------------------< convert_args >-----------------------------|
260 -- ----------------------------------------------------------------------------
261 Function convert_args
262 (
263 p_process_log_id in number,
264 p_module_cd in varchar2,
265 p_txn_id in number,
266 p_master_process_log_id in number,
267 p_message_text in varchar2,
268 p_message_type_cd in varchar2,
269 p_batch_status in varchar2,
270 p_batch_start_date in date,
271 p_batch_end_date in date,
272 p_txn_table_route_id in number,
273 p_log_context in varchar2,
274 p_information_category in varchar2,
275 p_information1 in varchar2,
276 p_information2 in varchar2,
277 p_information3 in varchar2,
278 p_information4 in varchar2,
279 p_information5 in varchar2,
280 p_information6 in varchar2,
281 p_information7 in varchar2,
282 p_information8 in varchar2,
283 p_information9 in varchar2,
284 p_information10 in varchar2,
285 p_information11 in varchar2,
286 p_information12 in varchar2,
287 p_information13 in varchar2,
288 p_information14 in varchar2,
289 p_information15 in varchar2,
290 p_information16 in varchar2,
291 p_information17 in varchar2,
292 p_information18 in varchar2,
293 p_information19 in varchar2,
294 p_information20 in varchar2,
295 p_information21 in varchar2,
296 p_information22 in varchar2,
297 p_information23 in varchar2,
298 p_information24 in varchar2,
299 p_information25 in varchar2,
300 p_information26 in varchar2,
301 p_information27 in varchar2,
302 p_information28 in varchar2,
303 p_information29 in varchar2,
304 p_information30 in varchar2,
305 p_object_version_number in number
306 )
307 Return g_rec_type is
308 --
309 l_rec g_rec_type;
310 l_proc varchar2(72) := g_package||'convert_args';
311 --
312 Begin
313 --
314 hr_utility.set_location('Entering:'||l_proc, 5);
315 --
316 -- Convert arguments into local l_rec structure.
317 --
318 l_rec.process_log_id := p_process_log_id;
319 l_rec.module_cd := p_module_cd;
320 l_rec.txn_id := p_txn_id;
321 l_rec.master_process_log_id := p_master_process_log_id;
322 l_rec.message_text := p_message_text;
323 l_rec.message_type_cd := p_message_type_cd;
324 l_rec.batch_status := p_batch_status;
325 l_rec.batch_start_date := p_batch_start_date;
326 l_rec.batch_end_date := p_batch_end_date;
327 l_rec.txn_table_route_id := p_txn_table_route_id;
328 l_rec.log_context := p_log_context;
329 l_rec.information_category := p_information_category;
330 l_rec.information1 := p_information1;
331 l_rec.information2 := p_information2;
332 l_rec.information3 := p_information3;
333 l_rec.information4 := p_information4;
334 l_rec.information5 := p_information5;
335 l_rec.information6 := p_information6;
336 l_rec.information7 := p_information7;
337 l_rec.information8 := p_information8;
338 l_rec.information9 := p_information9;
339 l_rec.information10 := p_information10;
340 l_rec.information11 := p_information11;
341 l_rec.information12 := p_information12;
342 l_rec.information13 := p_information13;
343 l_rec.information14 := p_information14;
344 l_rec.information15 := p_information15;
345 l_rec.information16 := p_information16;
346 l_rec.information17 := p_information17;
347 l_rec.information18 := p_information18;
348 l_rec.information19 := p_information19;
349 l_rec.information20 := p_information20;
350 l_rec.information21 := p_information21;
351 l_rec.information22 := p_information22;
352 l_rec.information23 := p_information23;
353 l_rec.information24 := p_information24;
354 l_rec.information25 := p_information25;
355 l_rec.information26 := p_information26;
356 l_rec.information27 := p_information27;
357 l_rec.information28 := p_information28;
358 l_rec.information29 := p_information29;
359 l_rec.information30 := p_information30;
360 l_rec.object_version_number := p_object_version_number;
361 --
362 -- Return the plsql record structure.
363 --
364 hr_utility.set_location(' Leaving:'||l_proc, 10);
365 Return(l_rec);
366 --
367 End convert_args;
368 --
369 end pqh_plg_shd;