[Home] [Help]
PACKAGE BODY: APPS.PQH_CER_BUS
Source
1 Package Body pqh_cer_bus as
2 /* $Header: pqcerrhi.pkb 115.6 2002/11/27 04:43:16 rpasapul ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_cer_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_copy_entity_result_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- copy_entity_result_id PK of record being inserted or updated.
24 -- object_version_number Object version number of record being
25 -- inserted or updated.
26 --
27 -- Post Success
28 -- Processing continues
29 --
30 -- Post Failure
31 -- Errors handled by the procedure
32 --
33 -- Access Status
34 -- Internal table handler use only.
35 --
36 Procedure chk_copy_entity_result_id(p_copy_entity_result_id in number,
37 p_object_version_number in number) is
38 --
39 l_proc varchar2(72) := g_package||'chk_copy_entity_result_id';
40 l_api_updating boolean;
41 --
42 Begin
43 --
44 hr_utility.set_location('Entering:'||l_proc, 5);
45 --
46 l_api_updating := pqh_cer_shd.api_updating
47 (p_copy_entity_result_id => p_copy_entity_result_id,
48 p_object_version_number => p_object_version_number);
49 --
50 if (l_api_updating
51 and nvl(p_copy_entity_result_id,hr_api.g_number)
52 <> pqh_cer_shd.g_old_rec.copy_entity_result_id) then
53 --
54 -- raise error as PK has changed
55 --
56 pqh_cer_shd.constraint_error('PQH_COPY_ENTITY_RESULTS_PK');
57 --
58 elsif not l_api_updating then
59 --
60 -- check if PK is null
61 --
62 if p_copy_entity_result_id is not null then
63 --
64 -- raise error as PK is not null
65 --
66 pqh_cer_shd.constraint_error('PQH_COPY_ENTITY_RESULTS_PK');
67 --
68 end if;
69 --
70 end if;
71 --
72 hr_utility.set_location('Leaving:'||l_proc, 10);
73 --
74 End chk_copy_entity_result_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_src_copy_entity_result_id >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 -- This procedure checks that a referenced foreign key actually exists
82 -- in the referenced table.
83 --
84 -- Pre-Conditions
85 -- None.
86 --
87 -- In Parameters
88 -- p_copy_entity_result_id PK
89 -- p_src_copy_entity_result_id ID of FK column
90 -- p_object_version_number object version number
91 --
92 -- Post Success
93 -- Processing continues
94 --
95 -- Post Failure
96 -- Error raised.
97 --
98 -- Access Status
99 -- Internal table handler use only.
100 --
101 Procedure chk_src_copy_entity_result_id (p_copy_entity_result_id in number,
102 p_src_copy_entity_result_id in number,
103 p_object_version_number in number) is
104 --
105 l_proc varchar2(72) := g_package||'chk_src_copy_entity_result_id';
106 l_api_updating boolean;
107 l_dummy varchar2(1);
108 --
109 cursor c1 is
110 select null
111 from pqh_copy_entity_results a
112 where a.copy_entity_result_id = p_src_copy_entity_result_id;
113 --
114 Begin
115 --
116 hr_utility.set_location('Entering:'||l_proc,5);
117 --
118 if p_src_copy_entity_result_id is not null then
119 --
120 -- check if src_copy_entity_result_id value exists in pqh_copy_entity_results table
121 --
122 open c1;
123 --
124 fetch c1 into l_dummy;
125 if c1%notfound then
126 --
127 close c1;
128 --
129 -- raise error as FK does not relate to PK in pqh_copy_entity_results
130 -- table.
131 --
132 -- pqh_cer_shd.constraint_error('PQH_COPY_ENTITY_RESULTS_FK2');
133 null;
134 --
135 end if;
136 --
137 close c1;
138 --
139 end if;
140 --
141 hr_utility.set_location('Leaving:'||l_proc,10);
142 --
143 End chk_src_copy_entity_result_id;
144 --
145 -- ----------------------------------------------------------------------------
146 -- |------< chk_copy_entity_txn_id >------|
147 -- ----------------------------------------------------------------------------
148 --
149 -- Description
150 -- This procedure checks that a referenced foreign key actually exists
151 -- in the referenced table.
152 --
153 -- Pre-Conditions
154 -- None.
155 --
156 -- In Parameters
157 -- p_copy_entity_result_id PK
158 -- p_copy_entity_txn_id ID of FK column
159 -- p_object_version_number object version number
160 --
161 -- Post Success
162 -- Processing continues
163 --
164 -- Post Failure
165 -- Error raised.
166 --
167 -- Access Status
168 -- Internal table handler use only.
169 --
170 Procedure chk_copy_entity_txn_id (p_copy_entity_result_id in number,
171 p_copy_entity_txn_id in number,
172 p_object_version_number in number) is
173 --
174 l_proc varchar2(72) := g_package||'chk_copy_entity_txn_id';
175 l_api_updating boolean;
176 l_dummy varchar2(1);
177 --
178 cursor c1 is
179 select null
180 from pqh_copy_entity_txns a
181 where a.copy_entity_txn_id = p_copy_entity_txn_id;
182 --
183 Begin
184 --
185 hr_utility.set_location('Entering:'||l_proc,5);
186 --
187 l_api_updating := pqh_cer_shd.api_updating
188 (p_copy_entity_result_id => p_copy_entity_result_id,
189 p_object_version_number => p_object_version_number);
190 --
191 if (l_api_updating
192 and nvl(p_copy_entity_txn_id,hr_api.g_number)
193 <> nvl(pqh_cer_shd.g_old_rec.copy_entity_txn_id,hr_api.g_number)
194 or not l_api_updating) then
195 --
196 -- check if copy_entity_txn_id value exists in pqh_copy_entity_txns table
197 --
198 open c1;
199 --
200 fetch c1 into l_dummy;
201 if c1%notfound then
202 --
203 close c1;
204 --
205 -- raise error as FK does not relate to PK in pqh_copy_entity_txns
206 -- table.
207 --
208 pqh_cer_shd.constraint_error('PQH_COPY_ENTITY_RESULTS_FK1');
209 --
210 end if;
211 --
212 close c1;
213 --
214 end if;
215 --
216 hr_utility.set_location('Leaving:'||l_proc,10);
217 --
218 End chk_copy_entity_txn_id;
219 --
220 -- ----------------------------------------------------------------------------
221 -- |------< chk_result_type_cd >------|
222 -- ----------------------------------------------------------------------------
223 --
224 -- Description
225 -- This procedure is used to check that the lookup value is valid.
226 --
227 -- Pre Conditions
228 -- None.
229 --
230 -- In Parameters
231 -- copy_entity_result_id PK of record being inserted or updated.
232 -- result_type_cd Value of lookup code.
233 -- effective_date effective date
234 -- object_version_number Object version number of record being
235 -- inserted or updated.
236 --
237 -- Post Success
238 -- Processing continues
239 --
240 -- Post Failure
241 -- Error handled by procedure
242 --
243 -- Access Status
244 -- Internal table handler use only.
245 --
246 Procedure chk_result_type_cd(p_copy_entity_result_id in number,
247 p_result_type_cd in varchar2,
248 p_effective_date in date,
249 p_object_version_number in number) is
250 --
251 l_proc varchar2(72) := g_package||'chk_result_type_cd';
252 l_api_updating boolean;
253 --
254 Begin
255 --
256 hr_utility.set_location('Entering:'||l_proc, 5);
257 --
258 l_api_updating := pqh_cer_shd.api_updating
259 (p_copy_entity_result_id => p_copy_entity_result_id,
260 p_object_version_number => p_object_version_number);
261 --
262 if (l_api_updating
263 and p_result_type_cd
264 <> nvl(pqh_cer_shd.g_old_rec.result_type_cd,hr_api.g_varchar2)
265 or not l_api_updating)
266 and p_result_type_cd is not null then
267 --
268 -- check if value of lookup falls within lookup type.
269 --
270 if hr_api.not_exists_in_hr_lookups
271 (p_lookup_type => 'PQH_GEN_STATUS',
272 p_lookup_code => p_result_type_cd,
273 p_effective_date => p_effective_date) then
274 --
275 -- raise error as does not exist as lookup
276 --
277 hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
278 -- hr_utility.raise_error;
279 --
280 end if;
281 --
282 end if;
283 --
284 hr_utility.set_location('Leaving:'||l_proc,10);
285 --
286 end chk_result_type_cd;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------------< insert_validate >----------------------------|
290 -- ----------------------------------------------------------------------------
291 Procedure insert_validate(p_rec in pqh_cer_shd.g_rec_type
292 ,p_effective_date in date) is
293 --
294 l_proc varchar2(72) := g_package||'insert_validate';
295 --
296 Begin
297 hr_utility.set_location('Entering:'||l_proc, 5);
298 --
299 -- Call all supporting business operations
300 --
301 chk_copy_entity_result_id
302 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
303 p_object_version_number => p_rec.object_version_number);
304 --
305 chk_src_copy_entity_result_id
306 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
307 p_src_copy_entity_result_id => p_rec.src_copy_entity_result_id,
308 p_object_version_number => p_rec.object_version_number);
309 --
310 chk_copy_entity_txn_id
311 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
312 p_copy_entity_txn_id => p_rec.copy_entity_txn_id,
313 p_object_version_number => p_rec.object_version_number);
314 --
315 chk_result_type_cd
316 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
317 p_result_type_cd => p_rec.result_type_cd,
318 p_effective_date => p_effective_date,
319 p_object_version_number => p_rec.object_version_number);
320 --
321 --
322 --
323 hr_utility.set_location(' Leaving:'||l_proc, 10);
324 End insert_validate;
325 --
326 -- ----------------------------------------------------------------------------
327 -- |---------------------------< update_validate >----------------------------|
328 -- ----------------------------------------------------------------------------
329 Procedure update_validate(p_rec in pqh_cer_shd.g_rec_type
330 ,p_effective_date in date) is
331 --
332 l_proc varchar2(72) := g_package||'update_validate';
333 --
334 Begin
335 hr_utility.set_location('Entering:'||l_proc, 5);
336 --
337 -- Call all supporting business operations
338 --
339 chk_copy_entity_result_id
340 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
341 p_object_version_number => p_rec.object_version_number);
342 --
343 chk_src_copy_entity_result_id
344 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
345 p_src_copy_entity_result_id => p_rec.src_copy_entity_result_id,
346 p_object_version_number => p_rec.object_version_number);
347 --
348 chk_copy_entity_txn_id
349 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
350 p_copy_entity_txn_id => p_rec.copy_entity_txn_id,
351 p_object_version_number => p_rec.object_version_number);
352 --
353 chk_result_type_cd
354 (p_copy_entity_result_id => p_rec.copy_entity_result_id,
355 p_result_type_cd => p_rec.result_type_cd,
356 p_effective_date => p_effective_date,
357 p_object_version_number => p_rec.object_version_number);
358 --
359 --
360 --
361 hr_utility.set_location(' Leaving:'||l_proc, 10);
362 End update_validate;
363 --
364 -- ----------------------------------------------------------------------------
365 -- |---------------------------< delete_validate >----------------------------|
366 -- ----------------------------------------------------------------------------
367 Procedure delete_validate(p_rec in pqh_cer_shd.g_rec_type
368 ,p_effective_date in date) is
369 --
370 l_proc varchar2(72) := g_package||'delete_validate';
371 --
372 Begin
373 hr_utility.set_location('Entering:'||l_proc, 5);
374 --
375 -- Call all supporting business operations
376 --
377 hr_utility.set_location(' Leaving:'||l_proc, 10);
378 End delete_validate;
379 --
380 end pqh_cer_bus;