[Home] [Help]
PACKAGE BODY: APPS.OKL_SIX_PVT
Source
1 PACKAGE BODY OKL_SIX_PVT AS
2 /* $Header: OKLSSIXB.pls 120.1 2005/07/08 23:54:50 cklee noship $ */
3
4 G_SOURCE_TRX_DATE_SUB_VAL CONSTANT VARCHAR2(30) DEFAULT 'OKL_SUB_TRX_DATE_SUB_VAL';
5 G_SOURCE_TRX_DATE_POOL_VAL CONSTANT VARCHAR2(30) DEFAULT 'OKL_SUB_TRX_DATE_POOL_VAL';
6
7 ---------------------------------------------------------------------------
8 -- PROCEDURE load_error_tbl
9 ---------------------------------------------------------------------------
10 PROCEDURE load_error_tbl (
11 px_error_rec IN OUT NOCOPY OKC_API.ERROR_REC_TYPE,
12 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
13
14 j INTEGER := NVL(px_error_tbl.LAST, 0) + 1;
15 last_msg_idx INTEGER := FND_MSG_PUB.COUNT_MSG;
16 l_msg_idx INTEGER := FND_MSG_PUB.G_NEXT;
17 BEGIN
18 -- FND_MSG_PUB has a small error in it. If we call FND_MSG_PUB.COUNT_AND_GET before
19 -- we call FND_MSG_PUB.GET, the variable FND_MSG_PUB uses to control the index of the
20 -- message stack gets set to 1. This makes sense until we call FND_MSG_PUB.GET which
21 -- automatically increments the index by 1, (making it 2), however, when the GET function
22 -- attempts to pull message 2, we get a NO_DATA_FOUND exception because there isn't any
23 -- message 2. To circumvent this problem, check the amount of messages and compensate.
24 -- Again, this error only occurs when 1 message is on the stack because COUNT_AND_GET
25 -- will only update the index variable when 1 and only 1 message is on the stack.
26 IF (last_msg_idx = 1) THEN
27 l_msg_idx := FND_MSG_PUB.G_FIRST;
28 END IF;
29 LOOP
30 fnd_msg_pub.get(
31 p_msg_index => l_msg_idx,
32 p_encoded => fnd_api.g_false,
33 p_data => px_error_rec.msg_data,
34 p_msg_index_out => px_error_rec.msg_count);
35 px_error_tbl(j) := px_error_rec;
36 j := j + 1;
37 EXIT WHEN (px_error_rec.msg_count = last_msg_idx);
38 END LOOP;
39 END load_error_tbl;
40 ---------------------------------------------------------------------------
41 -- FUNCTION find_highest_exception
42 ---------------------------------------------------------------------------
43 -- Finds the highest exception (G_RET_STS_UNEXP_ERROR)
44 -- in a OKC_API.ERROR_TBL_TYPE, and returns it.
45 FUNCTION find_highest_exception(
46 p_error_tbl IN OKC_API.ERROR_TBL_TYPE
47 ) RETURN VARCHAR2 IS
48 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
49 i INTEGER := 1;
50 BEGIN
51 IF (p_error_tbl.COUNT > 0) THEN
52 i := p_error_tbl.FIRST;
53 LOOP
54 IF (p_error_tbl(i).error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
55 IF (l_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
56 l_return_status := p_error_tbl(i).error_type;
57 END IF;
58 END IF;
59 EXIT WHEN (i = p_error_tbl.LAST);
60 i := p_error_tbl.NEXT(i);
61 END LOOP;
62 END IF;
63 RETURN(l_return_status);
64 END find_highest_exception;
65 ---------------------------------------------------------------------------
66 -- FUNCTION get_seq_id
67 ---------------------------------------------------------------------------
68 FUNCTION get_seq_id RETURN NUMBER IS
69 BEGIN
70 RETURN(okc_p_util.raw_to_number(sys_guid()));
71 END get_seq_id;
72
73 ---------------------------------------------------------------------------
74 -- PROCEDURE qc
75 ---------------------------------------------------------------------------
76 PROCEDURE qc IS
77 BEGIN
78 null;
79 END qc;
80
81 ---------------------------------------------------------------------------
82 -- PROCEDURE change_version
83 ---------------------------------------------------------------------------
84 PROCEDURE change_version IS
85 BEGIN
86 null;
87 END change_version;
88
89 ---------------------------------------------------------------------------
90 -- PROCEDURE api_copy
91 ---------------------------------------------------------------------------
92 PROCEDURE api_copy IS
93 BEGIN
94 null;
95 END api_copy;
96
97 ---------------------------------------------------------------------------
98 -- FUNCTION get_rec for: OKL_TRX_SUBSIDY_POOLS_V
99 ---------------------------------------------------------------------------
100 FUNCTION get_rec (
101 p_sixv_rec IN sixv_rec_type,
102 x_no_data_found OUT NOCOPY BOOLEAN
103 ) RETURN sixv_rec_type IS
104 CURSOR okl_trx_subsidy_pools_v_pk_csr (p_id IN NUMBER) IS
105 SELECT
106 ID,
107 OBJECT_VERSION_NUMBER,
108 TRX_TYPE_CODE,
109 SOURCE_TYPE_CODE,
110 SOURCE_OBJECT_ID,
111 SUBSIDY_POOL_ID,
112 DNZ_ASSET_NUMBER,
113 VENDOR_ID,
114 SOURCE_TRX_DATE,
115 TRX_DATE,
116 SUBSIDY_ID,
117 TRX_REASON_CODE,
118 TRX_CURRENCY_CODE,
119 TRX_AMOUNT,
120 SUBSIDY_POOL_CURRENCY_CODE,
121 SUBSIDY_POOL_AMOUNT,
122 CONVERSION_RATE,
123 ATTRIBUTE_CATEGORY,
124 ATTRIBUTE1,
125 ATTRIBUTE2,
126 ATTRIBUTE3,
127 ATTRIBUTE4,
128 ATTRIBUTE5,
129 ATTRIBUTE6,
130 ATTRIBUTE7,
131 ATTRIBUTE8,
132 ATTRIBUTE9,
133 ATTRIBUTE10,
134 ATTRIBUTE11,
135 ATTRIBUTE12,
136 ATTRIBUTE13,
137 ATTRIBUTE14,
138 ATTRIBUTE15,
139 CREATED_BY,
140 CREATION_DATE,
141 LAST_UPDATED_BY,
142 LAST_UPDATE_DATE,
143 LAST_UPDATE_LOGIN
144 FROM Okl_Trx_Subsidy_Pools_V
145 WHERE okl_trx_subsidy_pools_v.id = p_id;
146 l_okl_trx_subsidy_pools_v_pk okl_trx_subsidy_pools_v_pk_csr%ROWTYPE;
147 l_sixv_rec sixv_rec_type;
148 BEGIN
149 x_no_data_found := TRUE;
150 -- Get current database values
151 OPEN okl_trx_subsidy_pools_v_pk_csr (p_sixv_rec.id);
152 FETCH okl_trx_subsidy_pools_v_pk_csr INTO
153 l_sixv_rec.id,
154 l_sixv_rec.object_version_number,
155 l_sixv_rec.trx_type_code,
156 l_sixv_rec.source_type_code,
157 l_sixv_rec.source_object_id,
158 l_sixv_rec.subsidy_pool_id,
159 l_sixv_rec.dnz_asset_number,
160 l_sixv_rec.vendor_id,
161 l_sixv_rec.source_trx_date,
162 l_sixv_rec.trx_date,
163 l_sixv_rec.subsidy_id,
164 l_sixv_rec.trx_reason_code,
165 l_sixv_rec.trx_currency_code,
166 l_sixv_rec.trx_amount,
167 l_sixv_rec.subsidy_pool_currency_code,
168 l_sixv_rec.subsidy_pool_amount,
169 l_sixv_rec.conversion_rate,
170 l_sixv_rec.attribute_category,
171 l_sixv_rec.attribute1,
172 l_sixv_rec.attribute2,
173 l_sixv_rec.attribute3,
174 l_sixv_rec.attribute4,
175 l_sixv_rec.attribute5,
176 l_sixv_rec.attribute6,
177 l_sixv_rec.attribute7,
178 l_sixv_rec.attribute8,
179 l_sixv_rec.attribute9,
180 l_sixv_rec.attribute10,
181 l_sixv_rec.attribute11,
182 l_sixv_rec.attribute12,
183 l_sixv_rec.attribute13,
184 l_sixv_rec.attribute14,
185 l_sixv_rec.attribute15,
186 l_sixv_rec.created_by,
187 l_sixv_rec.creation_date,
188 l_sixv_rec.last_updated_by,
189 l_sixv_rec.last_update_date,
190 l_sixv_rec.last_update_login;
191 x_no_data_found := okl_trx_subsidy_pools_v_pk_csr%NOTFOUND;
192 CLOSE okl_trx_subsidy_pools_v_pk_csr;
193 RETURN(l_sixv_rec);
194 END get_rec;
195
196 ------------------------------------------------------------------
197 -- This version of get_rec sets error messages if no data found --
198 ------------------------------------------------------------------
199 FUNCTION get_rec (
200 p_sixv_rec IN sixv_rec_type,
201 x_return_status OUT NOCOPY VARCHAR2
202 ) RETURN sixv_rec_type IS
203 l_sixv_rec sixv_rec_type;
204 l_row_notfound BOOLEAN := TRUE;
205 BEGIN
206 x_return_status := OKC_API.G_RET_STS_SUCCESS;
207 l_sixv_rec := get_rec(p_sixv_rec, l_row_notfound);
208 IF (l_row_notfound) THEN
209 OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
210 x_return_status := OKC_API.G_RET_STS_ERROR;
211 END IF;
212 RETURN(l_sixv_rec);
213 END get_rec;
214 -----------------------------------------------------------
215 -- So we don't have to pass an "l_row_notfound" variable --
216 -----------------------------------------------------------
217 FUNCTION get_rec (
218 p_sixv_rec IN sixv_rec_type
219 ) RETURN sixv_rec_type IS
220 l_row_not_found BOOLEAN := TRUE;
221 BEGIN
222 RETURN(get_rec(p_sixv_rec, l_row_not_found));
223 END get_rec;
224 ---------------------------------------------------------------------------
225 -- FUNCTION get_rec for: OKL_TRX_SUBSIDY_POOLS
226 ---------------------------------------------------------------------------
227 FUNCTION get_rec (
228 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
229 x_no_data_found OUT NOCOPY BOOLEAN
230 ) RETURN okl_trx_subsidy_pools_rec_type IS
231 CURSOR okl_trx_subsidy_pools_pk_csr (p_id IN NUMBER) IS
232 SELECT
233 ID,
234 OBJECT_VERSION_NUMBER,
235 TRX_TYPE_CODE,
236 SOURCE_TYPE_CODE,
237 SOURCE_OBJECT_ID,
238 SUBSIDY_POOL_ID,
239 DNZ_ASSET_NUMBER,
240 VENDOR_ID,
241 SOURCE_TRX_DATE,
242 TRX_DATE,
243 SUBSIDY_ID,
244 TRX_REASON_CODE,
245 TRX_CURRENCY_CODE,
246 TRX_AMOUNT,
247 SUBSIDY_POOL_CURRENCY_CODE,
248 SUBSIDY_POOL_AMOUNT,
249 CONVERSION_RATE,
250 ATTRIBUTE_CATEGORY,
251 ATTRIBUTE1,
252 ATTRIBUTE2,
253 ATTRIBUTE3,
254 ATTRIBUTE4,
255 ATTRIBUTE5,
256 ATTRIBUTE6,
257 ATTRIBUTE7,
258 ATTRIBUTE8,
259 ATTRIBUTE9,
260 ATTRIBUTE10,
261 ATTRIBUTE11,
262 ATTRIBUTE12,
263 ATTRIBUTE13,
264 ATTRIBUTE14,
265 ATTRIBUTE15,
266 CREATED_BY,
267 CREATION_DATE,
268 LAST_UPDATED_BY,
269 LAST_UPDATE_DATE,
270 LAST_UPDATE_LOGIN
271 FROM Okl_Trx_Subsidy_Pools
272 WHERE okl_trx_subsidy_pools.id = p_id;
273 l_okl_trx_subsidy_pools_pk okl_trx_subsidy_pools_pk_csr%ROWTYPE;
274 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
275 BEGIN
276 x_no_data_found := TRUE;
277 -- Get current database values
278 OPEN okl_trx_subsidy_pools_pk_csr (p_okl_trx_subsidy_pools_rec.id);
279 FETCH okl_trx_subsidy_pools_pk_csr INTO
280 l_okl_trx_subsidy_pools_rec.id,
281 l_okl_trx_subsidy_pools_rec.object_version_number,
282 l_okl_trx_subsidy_pools_rec.trx_type_code,
283 l_okl_trx_subsidy_pools_rec.source_type_code,
284 l_okl_trx_subsidy_pools_rec.source_object_id,
285 l_okl_trx_subsidy_pools_rec.subsidy_pool_id,
286 l_okl_trx_subsidy_pools_rec.dnz_asset_number,
287 l_okl_trx_subsidy_pools_rec.vendor_id,
288 l_okl_trx_subsidy_pools_rec.source_trx_date,
289 l_okl_trx_subsidy_pools_rec.trx_date,
290 l_okl_trx_subsidy_pools_rec.subsidy_id,
291 l_okl_trx_subsidy_pools_rec.trx_reason_code,
292 l_okl_trx_subsidy_pools_rec.trx_currency_code,
293 l_okl_trx_subsidy_pools_rec.trx_amount,
294 l_okl_trx_subsidy_pools_rec.subsidy_pool_currency_code,
295 l_okl_trx_subsidy_pools_rec.subsidy_pool_amount,
296 l_okl_trx_subsidy_pools_rec.conversion_rate,
297 l_okl_trx_subsidy_pools_rec.attribute_category,
298 l_okl_trx_subsidy_pools_rec.attribute1,
299 l_okl_trx_subsidy_pools_rec.attribute2,
300 l_okl_trx_subsidy_pools_rec.attribute3,
301 l_okl_trx_subsidy_pools_rec.attribute4,
302 l_okl_trx_subsidy_pools_rec.attribute5,
303 l_okl_trx_subsidy_pools_rec.attribute6,
304 l_okl_trx_subsidy_pools_rec.attribute7,
305 l_okl_trx_subsidy_pools_rec.attribute8,
306 l_okl_trx_subsidy_pools_rec.attribute9,
307 l_okl_trx_subsidy_pools_rec.attribute10,
308 l_okl_trx_subsidy_pools_rec.attribute11,
309 l_okl_trx_subsidy_pools_rec.attribute12,
310 l_okl_trx_subsidy_pools_rec.attribute13,
311 l_okl_trx_subsidy_pools_rec.attribute14,
312 l_okl_trx_subsidy_pools_rec.attribute15,
313 l_okl_trx_subsidy_pools_rec.created_by,
314 l_okl_trx_subsidy_pools_rec.creation_date,
315 l_okl_trx_subsidy_pools_rec.last_updated_by,
316 l_okl_trx_subsidy_pools_rec.last_update_date,
317 l_okl_trx_subsidy_pools_rec.last_update_login;
318 x_no_data_found := okl_trx_subsidy_pools_pk_csr%NOTFOUND;
319 CLOSE okl_trx_subsidy_pools_pk_csr;
320 RETURN(l_okl_trx_subsidy_pools_rec);
321 END get_rec;
322
323 ------------------------------------------------------------------
324 -- This version of get_rec sets error messages if no data found --
325 ------------------------------------------------------------------
326 FUNCTION get_rec (
327 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
328 x_return_status OUT NOCOPY VARCHAR2
329 ) RETURN okl_trx_subsidy_pools_rec_type IS
330 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
331 l_row_notfound BOOLEAN := TRUE;
332 BEGIN
333 x_return_status := OKC_API.G_RET_STS_SUCCESS;
334 l_okl_trx_subsidy_pools_rec := get_rec(p_okl_trx_subsidy_pools_rec, l_row_notfound);
335 IF (l_row_notfound) THEN
336 OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
337 x_return_status := OKC_API.G_RET_STS_ERROR;
338 END IF;
339 RETURN(l_okl_trx_subsidy_pools_rec);
340 END get_rec;
341 -----------------------------------------------------------
342 -- So we don't have to pass an "l_row_notfound" variable --
343 -----------------------------------------------------------
344 FUNCTION get_rec (
345 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type
346 ) RETURN okl_trx_subsidy_pools_rec_type IS
347 l_row_not_found BOOLEAN := TRUE;
348 BEGIN
349 RETURN(get_rec(p_okl_trx_subsidy_pools_rec, l_row_not_found));
350 END get_rec;
351 ---------------------------------------------------------------------------
352 -- FUNCTION null_out_defaults for: OKL_TRX_SUBSIDY_POOLS_V
353 ---------------------------------------------------------------------------
354 FUNCTION null_out_defaults (
355 p_sixv_rec IN sixv_rec_type
356 ) RETURN sixv_rec_type IS
357 l_sixv_rec sixv_rec_type := p_sixv_rec;
358 BEGIN
359 IF (l_sixv_rec.id = OKC_API.G_MISS_NUM ) THEN
360 l_sixv_rec.id := NULL;
361 END IF;
362 IF (l_sixv_rec.object_version_number = OKC_API.G_MISS_NUM ) THEN
363 l_sixv_rec.object_version_number := NULL;
364 END IF;
365 IF (l_sixv_rec.trx_type_code = OKC_API.G_MISS_CHAR ) THEN
366 l_sixv_rec.trx_type_code := NULL;
367 END IF;
368 IF (l_sixv_rec.source_type_code = OKC_API.G_MISS_CHAR ) THEN
369 l_sixv_rec.source_type_code := NULL;
370 END IF;
371 IF (l_sixv_rec.source_object_id = OKC_API.G_MISS_NUM ) THEN
372 l_sixv_rec.source_object_id := NULL;
373 END IF;
374 IF (l_sixv_rec.subsidy_pool_id = OKC_API.G_MISS_NUM ) THEN
375 l_sixv_rec.subsidy_pool_id := NULL;
376 END IF;
377 IF (l_sixv_rec.dnz_asset_number = OKC_API.G_MISS_CHAR ) THEN
378 l_sixv_rec.dnz_asset_number := NULL;
379 END IF;
380 IF (l_sixv_rec.vendor_id = OKC_API.G_MISS_NUM ) THEN
381 l_sixv_rec.vendor_id := NULL;
382 END IF;
383 IF (l_sixv_rec.source_trx_date = OKC_API.G_MISS_DATE ) THEN
384 l_sixv_rec.source_trx_date := NULL;
385 END IF;
386 IF (l_sixv_rec.trx_date = OKC_API.G_MISS_DATE ) THEN
387 l_sixv_rec.trx_date := NULL;
388 END IF;
389 IF (l_sixv_rec.subsidy_id = OKC_API.G_MISS_NUM ) THEN
390 l_sixv_rec.subsidy_id := NULL;
391 END IF;
392 IF (l_sixv_rec.trx_reason_code = OKC_API.G_MISS_CHAR ) THEN
393 l_sixv_rec.trx_reason_code := NULL;
394 END IF;
395 IF (l_sixv_rec.trx_currency_code = OKC_API.G_MISS_CHAR ) THEN
396 l_sixv_rec.trx_currency_code := NULL;
397 END IF;
398 IF (l_sixv_rec.trx_amount = OKC_API.G_MISS_NUM ) THEN
399 l_sixv_rec.trx_amount := NULL;
400 END IF;
401 IF (l_sixv_rec.subsidy_pool_currency_code = OKC_API.G_MISS_CHAR ) THEN
402 l_sixv_rec.subsidy_pool_currency_code := NULL;
403 END IF;
404 IF (l_sixv_rec.subsidy_pool_amount = OKC_API.G_MISS_NUM ) THEN
405 l_sixv_rec.subsidy_pool_amount := NULL;
406 END IF;
407 IF (l_sixv_rec.conversion_rate = OKC_API.G_MISS_NUM ) THEN
408 l_sixv_rec.conversion_rate := NULL;
409 END IF;
410 IF (l_sixv_rec.attribute_category = OKC_API.G_MISS_CHAR ) THEN
411 l_sixv_rec.attribute_category := NULL;
412 END IF;
413 IF (l_sixv_rec.attribute1 = OKC_API.G_MISS_CHAR ) THEN
414 l_sixv_rec.attribute1 := NULL;
415 END IF;
416 IF (l_sixv_rec.attribute2 = OKC_API.G_MISS_CHAR ) THEN
417 l_sixv_rec.attribute2 := NULL;
418 END IF;
419 IF (l_sixv_rec.attribute3 = OKC_API.G_MISS_CHAR ) THEN
420 l_sixv_rec.attribute3 := NULL;
421 END IF;
422 IF (l_sixv_rec.attribute4 = OKC_API.G_MISS_CHAR ) THEN
423 l_sixv_rec.attribute4 := NULL;
424 END IF;
425 IF (l_sixv_rec.attribute5 = OKC_API.G_MISS_CHAR ) THEN
426 l_sixv_rec.attribute5 := NULL;
427 END IF;
428 IF (l_sixv_rec.attribute6 = OKC_API.G_MISS_CHAR ) THEN
429 l_sixv_rec.attribute6 := NULL;
430 END IF;
431 IF (l_sixv_rec.attribute7 = OKC_API.G_MISS_CHAR ) THEN
432 l_sixv_rec.attribute7 := NULL;
433 END IF;
434 IF (l_sixv_rec.attribute8 = OKC_API.G_MISS_CHAR ) THEN
435 l_sixv_rec.attribute8 := NULL;
436 END IF;
437 IF (l_sixv_rec.attribute9 = OKC_API.G_MISS_CHAR ) THEN
438 l_sixv_rec.attribute9 := NULL;
439 END IF;
440 IF (l_sixv_rec.attribute10 = OKC_API.G_MISS_CHAR ) THEN
441 l_sixv_rec.attribute10 := NULL;
442 END IF;
443 IF (l_sixv_rec.attribute11 = OKC_API.G_MISS_CHAR ) THEN
444 l_sixv_rec.attribute11 := NULL;
445 END IF;
446 IF (l_sixv_rec.attribute12 = OKC_API.G_MISS_CHAR ) THEN
447 l_sixv_rec.attribute12 := NULL;
448 END IF;
449 IF (l_sixv_rec.attribute13 = OKC_API.G_MISS_CHAR ) THEN
450 l_sixv_rec.attribute13 := NULL;
451 END IF;
452 IF (l_sixv_rec.attribute14 = OKC_API.G_MISS_CHAR ) THEN
453 l_sixv_rec.attribute14 := NULL;
454 END IF;
455 IF (l_sixv_rec.attribute15 = OKC_API.G_MISS_CHAR ) THEN
456 l_sixv_rec.attribute15 := NULL;
457 END IF;
458 IF (l_sixv_rec.created_by = OKC_API.G_MISS_NUM ) THEN
459 l_sixv_rec.created_by := NULL;
460 END IF;
461 IF (l_sixv_rec.creation_date = OKC_API.G_MISS_DATE ) THEN
462 l_sixv_rec.creation_date := NULL;
463 END IF;
464 IF (l_sixv_rec.last_updated_by = OKC_API.G_MISS_NUM ) THEN
465 l_sixv_rec.last_updated_by := NULL;
466 END IF;
467 IF (l_sixv_rec.last_update_date = OKC_API.G_MISS_DATE ) THEN
468 l_sixv_rec.last_update_date := NULL;
469 END IF;
470 IF (l_sixv_rec.last_update_login = OKC_API.G_MISS_NUM ) THEN
471 l_sixv_rec.last_update_login := NULL;
472 END IF;
473 RETURN(l_sixv_rec);
474 END null_out_defaults;
475 ---------------------------------
476 -- Validate_Attributes for: ID --
477 ---------------------------------
478 PROCEDURE validate_id(
479 x_return_status OUT NOCOPY VARCHAR2,
480 p_id IN NUMBER) IS
481 BEGIN
482 x_return_status := OKC_API.G_RET_STS_SUCCESS;
483 IF (p_id = OKC_API.G_MISS_NUM OR
484 p_id IS NULL)
485 THEN
486 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'id');
487 x_return_status := OKC_API.G_RET_STS_ERROR;
488 RAISE G_EXCEPTION_HALT_VALIDATION;
489 END IF;
490 EXCEPTION
491 WHEN G_EXCEPTION_HALT_VALIDATION THEN
492 null;
493 WHEN OTHERS THEN
494 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
495 ,p_msg_name => G_UNEXPECTED_ERROR
496 ,p_token1 => G_SQLCODE_TOKEN
497 ,p_token1_value => SQLCODE
498 ,p_token2 => G_SQLERRM_TOKEN
499 ,p_token2_value => SQLERRM);
500 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
501 END validate_id;
502 ----------------------------------------------------
503 -- Validate_Attributes for: OBJECT_VERSION_NUMBER --
504 ----------------------------------------------------
505 PROCEDURE validate_object_version_number(
506 x_return_status OUT NOCOPY VARCHAR2,
507 p_object_version_number IN NUMBER) IS
508 BEGIN
509 x_return_status := OKC_API.G_RET_STS_SUCCESS;
510 IF (p_object_version_number = OKC_API.G_MISS_NUM OR
511 p_object_version_number IS NULL)
512 THEN
513 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
514 x_return_status := OKC_API.G_RET_STS_ERROR;
515 RAISE G_EXCEPTION_HALT_VALIDATION;
516 END IF;
517 EXCEPTION
518 WHEN G_EXCEPTION_HALT_VALIDATION THEN
519 null;
520 WHEN OTHERS THEN
521 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
522 ,p_msg_name => G_UNEXPECTED_ERROR
523 ,p_token1 => G_SQLCODE_TOKEN
524 ,p_token1_value => SQLCODE
525 ,p_token2 => G_SQLERRM_TOKEN
526 ,p_token2_value => SQLERRM);
527 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
528 END validate_object_version_number;
529 ----------------------------------------------
530 -- Validate_Attributes for: TRX_TYPE_CODE --
531 ----------------------------------------------
532 PROCEDURE validate_trx_type_code(
533 x_return_status OUT NOCOPY VARCHAR2,
534 p_trx_type_code IN VARCHAR2) IS
535
536 -- start: cklee 07/07/2005
537 CURSOR c_get_trx_type_code_csr IS
538 SELECT 'X'
539 FROM fnd_lookups
540 WHERE lookup_type = 'OKL_SUB_POOL_LINE_TYPE'
541 AND lookup_code = p_trx_type_code;
542 lv_dummy VARCHAR2(1) := 'N';
543 -- end: cklee 07/07/2005
544
545 BEGIN
546 x_return_status := OKC_API.G_RET_STS_SUCCESS;
547 IF(p_trx_type_code IS NULL)THEN
548 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'trx_type_code');
549 x_return_status := OKC_API.G_RET_STS_ERROR;
550 RAISE G_EXCEPTION_HALT_VALIDATION;
551 END IF;
552 -- start: cklee 07/07/2005
553 /*
554 IF(p_trx_type_code NOT IN ('ADDITION', 'REDUCTION'))THEN
555 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'trx_type_code');
556 x_return_status := OKC_API.G_RET_STS_ERROR;
557 RAISE G_EXCEPTION_HALT_VALIDATION;
558 END IF;
559 */
560 OPEN c_get_trx_type_code_csr;
561 FETCH c_get_trx_type_code_csr INTO lv_dummy; CLOSE c_get_trx_type_code_csr;
562 IF(lv_dummy <> 'X')THEN
563 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'trx_type_code');
564 x_return_status := OKC_API.G_RET_STS_ERROR;
565 RAISE G_EXCEPTION_HALT_VALIDATION;
566 END IF;
567 -- end: cklee 07/07/2005
568
569 EXCEPTION
570 WHEN G_EXCEPTION_HALT_VALIDATION THEN
571 null;
572 WHEN OTHERS THEN
573 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
574 ,p_msg_name => G_UNEXPECTED_ERROR
575 ,p_token1 => G_SQLCODE_TOKEN
576 ,p_token1_value => SQLCODE
577 ,p_token2 => G_SQLERRM_TOKEN
578 ,p_token2_value => SQLERRM);
579 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
580 END validate_trx_type_code;
581 -----------------------------------------------
582 -- Validate_Attributes for: SOURCE_TYPE_CODE --
583 -----------------------------------------------
584 PROCEDURE validate_source_type_code(
585 x_return_status OUT NOCOPY VARCHAR2,
586 p_source_type_code IN VARCHAR2) IS
587
588 -- start: cklee 07/07/2005
589 CURSOR c_get_source_type_csr IS
590 SELECT 'X'
591 FROM fnd_lookups
592 WHERE lookup_type = 'OKL_SUB_POOL_TRX_SOURCE_TYPE'
593 AND lookup_code = p_source_type_code;
594 lv_dummy VARCHAR2(1) := 'N';
595 -- end: cklee 07/07/2005
596
597 BEGIN
598 x_return_status := OKC_API.G_RET_STS_SUCCESS;
599 IF (p_source_type_code = OKC_API.G_MISS_CHAR OR
600 p_source_type_code IS NULL)
601 THEN
602 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'source_type_code');
603 x_return_status := OKC_API.G_RET_STS_ERROR;
604 RAISE G_EXCEPTION_HALT_VALIDATION;
605 END IF;
606
607 -- start: cklee 07/07/2005
608 OPEN c_get_source_type_csr;
609 FETCH c_get_source_type_csr INTO lv_dummy; CLOSE c_get_source_type_csr;
610 IF(lv_dummy <> 'X')THEN
611 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'source_type_code');
612 x_return_status := OKC_API.G_RET_STS_ERROR;
613 RAISE G_EXCEPTION_HALT_VALIDATION;
614 END IF;
615 -- end: cklee 07/07/2005
616
617 EXCEPTION
618 WHEN G_EXCEPTION_HALT_VALIDATION THEN
619 null;
620 WHEN OTHERS THEN
621 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
622 ,p_msg_name => G_UNEXPECTED_ERROR
623 ,p_token1 => G_SQLCODE_TOKEN
624 ,p_token1_value => SQLCODE
625 ,p_token2 => G_SQLERRM_TOKEN
626 ,p_token2_value => SQLERRM);
627 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
628 END validate_source_type_code;
629 -----------------------------------------------
630 -- Validate_Attributes for: SOURCE_OBJECT_ID --
631 -----------------------------------------------
632 PROCEDURE validate_source_object_id(
633 x_return_status OUT NOCOPY VARCHAR2,
634 p_source_object_id IN NUMBER) IS
635 BEGIN
636 x_return_status := OKC_API.G_RET_STS_SUCCESS;
637 IF (p_source_object_id = OKC_API.G_MISS_NUM OR
638 p_source_object_id IS NULL)
639 THEN
640 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'source_object_id');
641 x_return_status := OKC_API.G_RET_STS_ERROR;
642 RAISE G_EXCEPTION_HALT_VALIDATION;
643 END IF;
644 EXCEPTION
645 WHEN G_EXCEPTION_HALT_VALIDATION THEN
646 null;
647 WHEN OTHERS THEN
648 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
649 ,p_msg_name => G_UNEXPECTED_ERROR
650 ,p_token1 => G_SQLCODE_TOKEN
651 ,p_token1_value => SQLCODE
652 ,p_token2 => G_SQLERRM_TOKEN
653 ,p_token2_value => SQLERRM);
654 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
655 END validate_source_object_id;
656 ----------------------------------------------
657 -- Validate_Attributes for: SUBSIDY_POOL_ID --
658 ----------------------------------------------
659 PROCEDURE validate_subsidy_pool_id(
660 x_return_status OUT NOCOPY VARCHAR2,
661 p_subsidy_pool_id IN NUMBER) IS
662 BEGIN
663 x_return_status := OKC_API.G_RET_STS_SUCCESS;
664 IF (p_subsidy_pool_id = OKC_API.G_MISS_NUM OR
665 p_subsidy_pool_id IS NULL)
666 THEN
667 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'subsidy_pool_id');
668 x_return_status := OKC_API.G_RET_STS_ERROR;
669 RAISE G_EXCEPTION_HALT_VALIDATION;
670 END IF;
671 EXCEPTION
672 WHEN G_EXCEPTION_HALT_VALIDATION THEN
673 null;
674 WHEN OTHERS THEN
675 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
676 ,p_msg_name => G_UNEXPECTED_ERROR
677 ,p_token1 => G_SQLCODE_TOKEN
678 ,p_token1_value => SQLCODE
679 ,p_token2 => G_SQLERRM_TOKEN
680 ,p_token2_value => SQLERRM);
681 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
682 END validate_subsidy_pool_id;
683
684 -- sjalasut added more validations on attributes. START
685
686 ----------------------------------------------
687 -- Validate_Attributes for: TRX_REASON_CODE --
688 ----------------------------------------------
689 PROCEDURE validate_trx_reason_code(
690 x_return_status OUT NOCOPY VARCHAR2,
691 p_trx_reason_code IN VARCHAR2) IS
692
693 CURSOR c_get_trx_reason_csr IS
694 SELECT 'X'
695 FROM fnd_lookups
696 WHERE lookup_type = 'OKL_SUB_POOL_TRX_REASON_TYPE'
697 AND lookup_code = p_trx_reason_code;
698 lv_dummy VARCHAR2(1);
699 BEGIN
700 x_return_status := OKC_API.G_RET_STS_SUCCESS;
701 lv_dummy := 'N';
702 IF(p_trx_reason_code IS NULL)THEN
703 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'trx_reason_code');
704 x_return_status := OKC_API.G_RET_STS_ERROR;
705 RAISE G_EXCEPTION_HALT_VALIDATION;
706 END IF;
707 OPEN c_get_trx_reason_csr;
708 FETCH c_get_trx_reason_csr INTO lv_dummy; CLOSE c_get_trx_reason_csr;
709 IF(lv_dummy <> 'X')THEN
710 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'trx_reason_code');
711 x_return_status := OKC_API.G_RET_STS_ERROR;
712 RAISE G_EXCEPTION_HALT_VALIDATION;
713 END IF;
714 EXCEPTION
715 WHEN G_EXCEPTION_HALT_VALIDATION THEN
716 null;
717 WHEN OTHERS THEN
718 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
719 ,p_msg_name => G_UNEXPECTED_ERROR
720 ,p_token1 => G_SQLCODE_TOKEN
721 ,p_token1_value => SQLCODE
722 ,p_token2 => G_SQLERRM_TOKEN
723 ,p_token2_value => SQLERRM);
724 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
725 END validate_trx_reason_code;
726
727 ----------------------------------------------
728 -- Validate_Attributes for: TRX_AMOUNT --
729 ----------------------------------------------
730 PROCEDURE validate_trx_amount(
731 x_return_status OUT NOCOPY VARCHAR2,
732 p_trx_amount IN NUMBER) IS
733 BEGIN
734 x_return_status := OKC_API.G_RET_STS_SUCCESS;
735 IF(p_trx_amount IS NULL)THEN
736 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'trx_amount');
737 x_return_status := OKC_API.G_RET_STS_ERROR;
738 RAISE G_EXCEPTION_HALT_VALIDATION;
739 END IF;
740 IF(p_trx_amount <= 0)THEN
741 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'trx_amount');
742 x_return_status := OKC_API.G_RET_STS_ERROR;
743 RAISE G_EXCEPTION_HALT_VALIDATION;
744 END IF;
745 EXCEPTION
746 WHEN G_EXCEPTION_HALT_VALIDATION THEN
747 null;
748 WHEN OTHERS THEN
749 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
750 ,p_msg_name => G_UNEXPECTED_ERROR
751 ,p_token1 => G_SQLCODE_TOKEN
752 ,p_token1_value => SQLCODE
753 ,p_token2 => G_SQLERRM_TOKEN
754 ,p_token2_value => SQLERRM);
755 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
756 END validate_trx_amount;
757
758 ----------------------------------------------
759 -- Validate_Attributes for: SOURCE_TRX_DATE --
760 ----------------------------------------------
761 PROCEDURE validate_source_trx_date(
762 x_return_status OUT NOCOPY VARCHAR2,
763 p_source_trx_date IN VARCHAR2) IS
764
765 BEGIN
766 x_return_status := OKC_API.G_RET_STS_SUCCESS;
767 IF(p_source_trx_date IS NULL)THEN
768 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'source_trx_date');
769 x_return_status := OKC_API.G_RET_STS_ERROR;
770 RAISE G_EXCEPTION_HALT_VALIDATION;
771 END IF;
772 EXCEPTION
773 WHEN G_EXCEPTION_HALT_VALIDATION THEN
774 null;
775 WHEN OTHERS THEN
776 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
777 ,p_msg_name => G_UNEXPECTED_ERROR
778 ,p_token1 => G_SQLCODE_TOKEN
779 ,p_token1_value => SQLCODE
780 ,p_token2 => G_SQLERRM_TOKEN
781 ,p_token2_value => SQLERRM);
782 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
783 END validate_source_trx_date;
784
785 -----------------------------------------------
786 -- Validate_Attributes for: DNZ_ASSET_NUMBER --
787 -----------------------------------------------
788 PROCEDURE validate_dnz_asset_number(
789 x_return_status OUT NOCOPY VARCHAR2,
790 p_dnz_asset_number IN VARCHAR2) IS
791
792 BEGIN
793 x_return_status := OKC_API.G_RET_STS_SUCCESS;
794 IF(p_dnz_asset_number IS NULL)THEN
795 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'dnz_asset_number');
796 x_return_status := OKC_API.G_RET_STS_ERROR;
797 RAISE G_EXCEPTION_HALT_VALIDATION;
798 END IF;
799 EXCEPTION
800 WHEN G_EXCEPTION_HALT_VALIDATION THEN
801 NULL;
802 WHEN OTHERS THEN
803 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
804 ,p_msg_name => G_UNEXPECTED_ERROR
805 ,p_token1 => G_SQLCODE_TOKEN
806 ,p_token1_value => SQLCODE
807 ,p_token2 => G_SQLERRM_TOKEN
808 ,p_token2_value => SQLERRM);
809 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
810 END validate_dnz_asset_number;
811
812 -- sjalasut added more validations on attributes. END
813
814 -- start: cklee 07/07/2005
815 -----------------------------------------------
816 -- Validate_Attributes for: VENDOR_ID --
817 -----------------------------------------------
818 PROCEDURE validate_vendor_id(
819 x_return_status OUT NOCOPY VARCHAR2,
820 p_vendor_id IN NUMBER) IS
821
822 CURSOR c_get_vendor_csr IS
823 SELECT 'X'
824 FROM po_vendors
825 WHERE vendor_id = p_vendor_id;
826 lv_dummy VARCHAR2(1) := 'N';
827
828 BEGIN
829 x_return_status := OKC_API.G_RET_STS_SUCCESS;
830 IF(p_vendor_id IS NULL)THEN
831 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'vendor_id');
832 x_return_status := OKC_API.G_RET_STS_ERROR;
833 RAISE G_EXCEPTION_HALT_VALIDATION;
834 END IF;
835
836 OPEN c_get_vendor_csr;
837 FETCH c_get_vendor_csr INTO lv_dummy; CLOSE c_get_vendor_csr;
838 IF(lv_dummy <> 'X')THEN
839 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'vendor_id');
840 x_return_status := OKC_API.G_RET_STS_ERROR;
841 RAISE G_EXCEPTION_HALT_VALIDATION;
842 END IF;
843
844 EXCEPTION
845 WHEN G_EXCEPTION_HALT_VALIDATION THEN
846 NULL;
847 WHEN OTHERS THEN
848 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
849 ,p_msg_name => G_UNEXPECTED_ERROR
850 ,p_token1 => G_SQLCODE_TOKEN
851 ,p_token1_value => SQLCODE
852 ,p_token2 => G_SQLERRM_TOKEN
853 ,p_token2_value => SQLERRM);
854 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
855 END validate_vendor_id;
856
857 -----------------------------------------------
858 -- Validate_Attributes for: TRX_CURRENCY_CODE --
859 -----------------------------------------------
860 PROCEDURE validate_trx_currency_code(
861 x_return_status OUT NOCOPY VARCHAR2,
862 p_trx_currency_code IN VARCHAR2) IS
863
864 CURSOR c_get_trx_currency_csr IS
865 SELECT 'X'
866 FROM gl_currencies
867 WHERE CURRENCY_CODE = p_trx_currency_code;
868 lv_dummy VARCHAR2(1) := 'N';
869
870 BEGIN
871 x_return_status := OKC_API.G_RET_STS_SUCCESS;
872 IF(p_trx_currency_code IS NULL)THEN
873 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'trx_currency_code');
874 x_return_status := OKC_API.G_RET_STS_ERROR;
875 RAISE G_EXCEPTION_HALT_VALIDATION;
876 END IF;
877
878 OPEN c_get_trx_currency_csr;
879 FETCH c_get_trx_currency_csr INTO lv_dummy; CLOSE c_get_trx_currency_csr;
880 IF(lv_dummy <> 'X')THEN
881 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'trx_currency_code');
882 x_return_status := OKC_API.G_RET_STS_ERROR;
883 RAISE G_EXCEPTION_HALT_VALIDATION;
884 END IF;
885
886 EXCEPTION
887 WHEN G_EXCEPTION_HALT_VALIDATION THEN
888 NULL;
889 WHEN OTHERS THEN
890 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
891 ,p_msg_name => G_UNEXPECTED_ERROR
892 ,p_token1 => G_SQLCODE_TOKEN
893 ,p_token1_value => SQLCODE
894 ,p_token2 => G_SQLERRM_TOKEN
895 ,p_token2_value => SQLERRM);
896 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
897 END validate_trx_currency_code;
898
899 -----------------------------------------------
900 -- Validate_Attributes for: SUBSIDY_POOL_AMOUNT --
901 -----------------------------------------------
902 PROCEDURE validate_subsidy_pool_amount(
903 x_return_status OUT NOCOPY VARCHAR2,
904 p_subsidy_pool_amount IN NUMBER) IS
905
906 BEGIN
907 x_return_status := OKC_API.G_RET_STS_SUCCESS;
908 IF(p_subsidy_pool_amount IS NULL)THEN
909 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'subsidy_pool_amount');
910 x_return_status := OKC_API.G_RET_STS_ERROR;
911 RAISE G_EXCEPTION_HALT_VALIDATION;
912 END IF;
913 EXCEPTION
914 WHEN G_EXCEPTION_HALT_VALIDATION THEN
915 NULL;
916 WHEN OTHERS THEN
917 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
918 ,p_msg_name => G_UNEXPECTED_ERROR
919 ,p_token1 => G_SQLCODE_TOKEN
920 ,p_token1_value => SQLCODE
921 ,p_token2 => G_SQLERRM_TOKEN
922 ,p_token2_value => SQLERRM);
923 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
924 END validate_subsidy_pool_amount;
925
926 -----------------------------------------------
927 -- Validate_Attributes for: SUBSIDY_POOL_CURRENCY_CODE --
928 -----------------------------------------------
929 PROCEDURE validate_subsidy_pool_cur(
930 x_return_status OUT NOCOPY VARCHAR2,
931 p_subsidy_pool_cur IN VARCHAR2) IS
932
933 BEGIN
934 x_return_status := OKC_API.G_RET_STS_SUCCESS;
935 IF(p_subsidy_pool_cur IS NULL)THEN
936 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'subsidy_pool_currency_code');
937 x_return_status := OKC_API.G_RET_STS_ERROR;
938 RAISE G_EXCEPTION_HALT_VALIDATION;
939 END IF;
940 EXCEPTION
941 WHEN G_EXCEPTION_HALT_VALIDATION THEN
942 NULL;
943 WHEN OTHERS THEN
944 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
945 ,p_msg_name => G_UNEXPECTED_ERROR
946 ,p_token1 => G_SQLCODE_TOKEN
947 ,p_token1_value => SQLCODE
948 ,p_token2 => G_SQLERRM_TOKEN
949 ,p_token2_value => SQLERRM);
950 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
951 END validate_subsidy_pool_cur;
952
953 -----------------------------------------------
954 -- Validate_Attributes for: CONVERSION_RATE --
955 -----------------------------------------------
956 PROCEDURE validate_conversion_rate(
957 x_return_status OUT NOCOPY VARCHAR2,
958 p_conversion_rate IN NUMBER) IS
959
960 BEGIN
961 x_return_status := OKC_API.G_RET_STS_SUCCESS;
962 IF(p_conversion_rate IS NULL)THEN
963 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'conversion_rate');
964 x_return_status := OKC_API.G_RET_STS_ERROR;
965 RAISE G_EXCEPTION_HALT_VALIDATION;
966 END IF;
967 EXCEPTION
968 WHEN G_EXCEPTION_HALT_VALIDATION THEN
969 NULL;
970 WHEN OTHERS THEN
971 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
972 ,p_msg_name => G_UNEXPECTED_ERROR
973 ,p_token1 => G_SQLCODE_TOKEN
974 ,p_token1_value => SQLCODE
975 ,p_token2 => G_SQLERRM_TOKEN
976 ,p_token2_value => SQLERRM);
977 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
978 END validate_conversion_rate;
979
980 -- end: cklee 07/07/2005
981
982 ---------------------------------------------------------------------------
983 -- FUNCTION Validate_Attributes
984 ---------------------------------------------------------------------------
985 -----------------------------------------------------
986 -- Validate_Attributes for:OKL_TRX_SUBSIDY_POOLS_V --
987 -----------------------------------------------------
988 FUNCTION Validate_Attributes (
989 p_sixv_rec IN sixv_rec_type
990 ) RETURN VARCHAR2 IS
991 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
992 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
993 BEGIN
994
995 -----------------------------
996 -- Column Level Validation --
997 -----------------------------
998 -- ***
999 -- id
1000 -- ***
1001 -- sjalasut: commented for subsidy pools enhancements
1002 -- for okl_trx_subsidy_pools, data is always inserted and never updated or deleted
1003 -- therefore validate_id and validate_object_version number are hampring other validation logic
1004 --validate_id(x_return_status, p_sixv_rec.id);
1005 --IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1006 --l_return_status := x_return_status;
1007 --RAISE G_EXCEPTION_HALT_VALIDATION;
1008 --END IF;
1009
1010 -- ***
1011 -- object_version_number
1012 -- ***
1013 -- commenting ovn check as records are only inserted into this table and not deleted or updated
1014 --validate_object_version_number(x_return_status, p_sixv_rec.object_version_number);
1015 --IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1016 --l_return_status := x_return_status;
1017 --RAISE G_EXCEPTION_HALT_VALIDATION;
1018 --END IF;
1019
1020 -- ***
1021 -- trx_type_code
1022 -- ***
1023 validate_trx_type_code(x_return_status, p_sixv_rec.trx_type_code);
1024 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1025 l_return_status := x_return_status;
1026 RAISE G_EXCEPTION_HALT_VALIDATION;
1027 END IF;
1028
1029 -- ***
1030 -- source_type_code
1031 -- ***
1032 validate_source_type_code(x_return_status, p_sixv_rec.source_type_code);
1033 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1034 l_return_status := x_return_status;
1035 RAISE G_EXCEPTION_HALT_VALIDATION;
1036 END IF;
1037
1038 -- ***
1039 -- source_object_id
1040 -- ***
1041 validate_source_object_id(x_return_status, p_sixv_rec.source_object_id);
1042 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1043 l_return_status := x_return_status;
1044 RAISE G_EXCEPTION_HALT_VALIDATION;
1045 END IF;
1046
1047 -- ***
1048 -- subsidy_pool_id
1049 -- ***
1050 validate_subsidy_pool_id(x_return_status, p_sixv_rec.subsidy_pool_id);
1051 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1052 l_return_status := x_return_status;
1053 RAISE G_EXCEPTION_HALT_VALIDATION;
1054 END IF;
1055
1056 -- sjalasut added more column validations. START
1057
1058 -- ***
1059 -- trx_reason_code
1060 -- ***
1061 validate_trx_reason_code(x_return_status, p_sixv_rec.trx_reason_code);
1062 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1063 l_return_status := x_return_status;
1064 RAISE G_EXCEPTION_HALT_VALIDATION;
1065 END IF;
1066
1067 -- ***
1068 -- trx_amount
1069 -- ***
1070 validate_trx_amount(x_return_status, p_sixv_rec.trx_amount);
1071 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1072 l_return_status := x_return_status;
1073 RAISE G_EXCEPTION_HALT_VALIDATION;
1074 END IF;
1075
1076 -- ***
1077 -- source_trx_date
1078 -- ***
1079 validate_source_trx_date(x_return_status, p_sixv_rec.trx_type_code);
1080 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1081 l_return_status := x_return_status;
1082 RAISE G_EXCEPTION_HALT_VALIDATION;
1083 END IF;
1084
1085
1086 -- ***
1087 -- dnz_asset_number
1088 -- ***
1089 validate_dnz_asset_number(x_return_status, p_sixv_rec.dnz_asset_number);
1090 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1091 l_return_status := x_return_status;
1092 RAISE G_EXCEPTION_HALT_VALIDATION;
1093 END IF;
1094
1095 -- sjalasut added more column validations. END
1096
1097 -- start: cklee 07/07/2005
1098 -- ***
1099 -- vendor id
1100 -- ***
1101 validate_vendor_id(x_return_status, p_sixv_rec.vendor_id);
1102 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1103 l_return_status := x_return_status;
1104 RAISE G_EXCEPTION_HALT_VALIDATION;
1105 END IF;
1106
1107 -- ***
1108 -- trx_currency_code
1109 -- ***
1110 validate_trx_currency_code(x_return_status, p_sixv_rec.trx_currency_code);
1111 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1112 l_return_status := x_return_status;
1113 RAISE G_EXCEPTION_HALT_VALIDATION;
1114 END IF;
1115
1116
1117 IF p_sixv_rec.trx_type_code = 'ADDITION' THEN
1118 -- ***
1119 -- subsidy_pool_amount
1120 -- ***
1121 validate_subsidy_pool_amount(x_return_status, p_sixv_rec.subsidy_pool_amount);
1122 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1123 l_return_status := x_return_status;
1124 RAISE G_EXCEPTION_HALT_VALIDATION;
1125 END IF;
1126
1127 -- ***
1128 -- subsidy_pool_currency_code
1129 -- ***
1130 validate_subsidy_pool_cur(x_return_status, p_sixv_rec.subsidy_pool_currency_code);
1131 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1132 l_return_status := x_return_status;
1133 RAISE G_EXCEPTION_HALT_VALIDATION;
1134 END IF;
1135
1136 -- ***
1137 -- conversion_rate
1138 -- ***
1139 validate_conversion_rate(x_return_status, p_sixv_rec.conversion_rate);
1140 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1141 l_return_status := x_return_status;
1142 RAISE G_EXCEPTION_HALT_VALIDATION;
1143 END IF;
1144 END IF; -- IF p_sixv_rec.trx_type_code = 'ADDITION' THEN
1145
1146 -- end: cklee 07/07/2005
1147
1148 RETURN(l_return_status);
1149 EXCEPTION
1150 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1151 RETURN(l_return_status);
1152 WHEN OTHERS THEN
1153 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
1154 ,p_msg_name => G_UNEXPECTED_ERROR
1155 ,p_token1 => G_SQLCODE_TOKEN
1156 ,p_token1_value => SQLCODE
1157 ,p_token2 => G_SQLERRM_TOKEN
1158 ,p_token2_value => SQLERRM);
1159 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1160 RETURN(l_return_status);
1161 END Validate_Attributes;
1162 ---------------------------------------------------------------------------
1163 -- PROCEDURE Validate_Record
1164 ---------------------------------------------------------------------------
1165 -------------------------------------------------
1166 -- Validate Record for:OKL_TRX_SUBSIDY_POOLS_V --
1167 -------------------------------------------------
1168 FUNCTION Validate_Record (
1169 p_sixv_rec IN sixv_rec_type,
1170 p_db_sixv_rec IN sixv_rec_type
1171 ) RETURN VARCHAR2 IS
1172 CURSOR c_get_sub_dates_csr IS
1173 SELECT effective_from_date, effective_to_date, name
1174 FROM okl_subsidies_b
1175 WHERE id = p_sixv_rec.subsidy_id;
1176 cv_get_sub_dates c_get_sub_dates_csr%ROWTYPE;
1177 CURSOR c_get_sub_pool_dates_csr IS
1178 SELECT effective_from_date, effective_to_date, subsidy_pool_name
1179 FROM okl_subsidy_pools_b
1180 WHERE id = p_sixv_rec.subsidy_pool_id;
1181 cv_get_sub_pool_dates c_get_sub_pool_dates_csr%ROWTYPE;
1182 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1183 BEGIN
1184 -- sjalasut added validation for the source_trx_date. START
1185
1186 -- validate the source transaction date. the source transaction date is contract start date if the sales quote is being approved,
1187 -- date of deletion on delete sales payment quote, acceptance date of sales payment quote, asset line date for contract booking,
1188 -- rebook transaction date on contract rebook, split date on split contract, reversal date on contract reversal.
1189 -- validate if the source transaction date is between the effective dates of subsidy and the subsidy pool in that order
1190 OPEN c_get_sub_dates_csr;
1191 FETCH c_get_sub_dates_csr INTO cv_get_sub_dates;
1192 CLOSE c_get_sub_dates_csr;
1193 IF(NOT p_sixv_rec.source_trx_date BETWEEN cv_get_sub_dates.effective_from_date AND
1194 NVL(cv_get_sub_dates.effective_to_date,OKL_ACCOUNTING_UTIL.g_final_date))THEN
1195 OKC_API.set_message(G_APP_NAME, G_SOURCE_TRX_DATE_SUB_VAL, 'TRX_DATE', p_sixv_rec.source_trx_date, 'SUBSIDY', cv_get_sub_dates.name);
1196 l_return_status := OKC_API.G_RET_STS_ERROR;
1197 END IF;
1198 OPEN c_get_sub_pool_dates_csr;
1199 FETCH c_get_sub_pool_dates_csr INTO cv_get_sub_pool_dates;
1200 CLOSE c_get_sub_pool_dates_csr;
1201 IF(NOT p_sixv_rec.source_trx_date BETWEEN cv_get_sub_pool_dates.effective_from_date AND
1202 NVL(cv_get_sub_pool_dates.effective_to_date,OKL_ACCOUNTING_UTIL.g_final_date))THEN
1203 OKC_API.set_message(G_APP_NAME, G_SOURCE_TRX_DATE_POOL_VAL, 'TRX_DATE', p_sixv_rec.source_trx_date, 'SUB_POOL', cv_get_sub_pool_dates.subsidy_pool_name);
1204 l_return_status := OKC_API.G_RET_STS_ERROR;
1205 END IF;
1206
1207 -- sjalasut added validation for the source_trx_date. END
1208
1209 RETURN (l_return_status);
1210 END Validate_Record;
1211 FUNCTION Validate_Record (
1212 p_sixv_rec IN sixv_rec_type
1213 ) RETURN VARCHAR2 IS
1214 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1215 l_db_sixv_rec sixv_rec_type := get_rec(p_sixv_rec);
1216 BEGIN
1217 l_return_status := Validate_Record(p_sixv_rec => p_sixv_rec,
1218 p_db_sixv_rec => l_db_sixv_rec);
1219 RETURN (l_return_status);
1220 END Validate_Record;
1221
1222 ---------------------------------------------------------------------------
1223 -- PROCEDURE Migrate
1224 ---------------------------------------------------------------------------
1225 PROCEDURE migrate (
1226 p_from IN sixv_rec_type,
1227 p_to IN OUT NOCOPY okl_trx_subsidy_pools_rec_type
1228 ) IS
1229 BEGIN
1230 p_to.id := p_from.id;
1231 p_to.object_version_number := p_from.object_version_number;
1232 p_to.trx_type_code := p_from.trx_type_code;
1233 p_to.source_type_code := p_from.source_type_code;
1234 p_to.source_object_id := p_from.source_object_id;
1235 p_to.subsidy_pool_id := p_from.subsidy_pool_id;
1236 p_to.dnz_asset_number := p_from.dnz_asset_number;
1237 p_to.vendor_id := p_from.vendor_id;
1238 p_to.source_trx_date := p_from.source_trx_date;
1239 p_to.trx_date := p_from.trx_date;
1240 p_to.subsidy_id := p_from.subsidy_id;
1241 p_to.trx_reason_code := p_from.trx_reason_code;
1242 p_to.trx_currency_code := p_from.trx_currency_code;
1243 p_to.trx_amount := p_from.trx_amount;
1244 p_to.subsidy_pool_currency_code := p_from.subsidy_pool_currency_code;
1245 p_to.subsidy_pool_amount := p_from.subsidy_pool_amount;
1246 p_to.conversion_rate := p_from.conversion_rate;
1247 p_to.attribute_category := p_from.attribute_category;
1248 p_to.attribute1 := p_from.attribute1;
1249 p_to.attribute2 := p_from.attribute2;
1250 p_to.attribute3 := p_from.attribute3;
1251 p_to.attribute4 := p_from.attribute4;
1252 p_to.attribute5 := p_from.attribute5;
1253 p_to.attribute6 := p_from.attribute6;
1254 p_to.attribute7 := p_from.attribute7;
1255 p_to.attribute8 := p_from.attribute8;
1256 p_to.attribute9 := p_from.attribute9;
1257 p_to.attribute10 := p_from.attribute10;
1258 p_to.attribute11 := p_from.attribute11;
1259 p_to.attribute12 := p_from.attribute12;
1260 p_to.attribute13 := p_from.attribute13;
1261 p_to.attribute14 := p_from.attribute14;
1262 p_to.attribute15 := p_from.attribute15;
1263 p_to.created_by := p_from.created_by;
1264 p_to.creation_date := p_from.creation_date;
1265 p_to.last_updated_by := p_from.last_updated_by;
1266 p_to.last_update_date := p_from.last_update_date;
1267 p_to.last_update_login := p_from.last_update_login;
1268 END migrate;
1269 PROCEDURE migrate (
1270 p_from IN okl_trx_subsidy_pools_rec_type,
1271 p_to IN OUT NOCOPY sixv_rec_type
1272 ) IS
1273 BEGIN
1274 p_to.id := p_from.id;
1275 p_to.object_version_number := p_from.object_version_number;
1276 p_to.trx_type_code := p_from.trx_type_code;
1277 p_to.source_type_code := p_from.source_type_code;
1278 p_to.source_object_id := p_from.source_object_id;
1279 p_to.subsidy_pool_id := p_from.subsidy_pool_id;
1280 p_to.dnz_asset_number := p_from.dnz_asset_number;
1281 p_to.vendor_id := p_from.vendor_id;
1282 p_to.source_trx_date := p_from.source_trx_date;
1283 p_to.trx_date := p_from.trx_date;
1284 p_to.subsidy_id := p_from.subsidy_id;
1285 p_to.trx_reason_code := p_from.trx_reason_code;
1286 p_to.trx_currency_code := p_from.trx_currency_code;
1287 p_to.trx_amount := p_from.trx_amount;
1288 p_to.subsidy_pool_currency_code := p_from.subsidy_pool_currency_code;
1289 p_to.subsidy_pool_amount := p_from.subsidy_pool_amount;
1290 p_to.conversion_rate := p_from.conversion_rate;
1291 p_to.attribute_category := p_from.attribute_category;
1292 p_to.attribute1 := p_from.attribute1;
1293 p_to.attribute2 := p_from.attribute2;
1294 p_to.attribute3 := p_from.attribute3;
1295 p_to.attribute4 := p_from.attribute4;
1296 p_to.attribute5 := p_from.attribute5;
1297 p_to.attribute6 := p_from.attribute6;
1298 p_to.attribute7 := p_from.attribute7;
1299 p_to.attribute8 := p_from.attribute8;
1300 p_to.attribute9 := p_from.attribute9;
1301 p_to.attribute10 := p_from.attribute10;
1302 p_to.attribute11 := p_from.attribute11;
1303 p_to.attribute12 := p_from.attribute12;
1304 p_to.attribute13 := p_from.attribute13;
1305 p_to.attribute14 := p_from.attribute14;
1306 p_to.attribute15 := p_from.attribute15;
1307 p_to.created_by := p_from.created_by;
1308 p_to.creation_date := p_from.creation_date;
1309 p_to.last_updated_by := p_from.last_updated_by;
1310 p_to.last_update_date := p_from.last_update_date;
1311 p_to.last_update_login := p_from.last_update_login;
1312 END migrate;
1313 ---------------------------------------------------------------------------
1314 -- PROCEDURE validate_row
1315 ---------------------------------------------------------------------------
1316 ----------------------------------------------
1317 -- validate_row for:OKL_TRX_SUBSIDY_POOLS_V --
1318 ----------------------------------------------
1319 PROCEDURE validate_row(
1320 p_api_version IN NUMBER,
1321 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1322 x_return_status OUT NOCOPY VARCHAR2,
1323 x_msg_count OUT NOCOPY NUMBER,
1324 x_msg_data OUT NOCOPY VARCHAR2,
1325 p_sixv_rec IN sixv_rec_type) IS
1326
1327 l_api_version CONSTANT NUMBER := 1;
1328 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
1329 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1330 l_sixv_rec sixv_rec_type := p_sixv_rec;
1331 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
1332 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
1333 BEGIN
1334 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1335 G_PKG_NAME,
1336 p_init_msg_list,
1337 l_api_version,
1338 p_api_version,
1339 '_PVT',
1340 x_return_status);
1341 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1342 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1343 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1344 RAISE OKC_API.G_EXCEPTION_ERROR;
1345 END IF;
1346 --- Validate all non-missing attributes (Item Level Validation)
1347 l_return_status := Validate_Attributes(l_sixv_rec);
1348 --- If any errors happen abort API
1349 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1350 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1351 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1352 RAISE OKC_API.G_EXCEPTION_ERROR;
1353 END IF;
1354 l_return_status := Validate_Record(l_sixv_rec);
1355 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1356 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1357 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1358 RAISE OKC_API.G_EXCEPTION_ERROR;
1359 END IF;
1360 x_return_status := l_return_status;
1361 EXCEPTION
1362 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1363 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1364 (
1365 l_api_name,
1366 G_PKG_NAME,
1367 'OKC_API.G_RET_STS_ERROR',
1368 x_msg_count,
1369 x_msg_data,
1370 '_PVT'
1371 );
1372 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1373 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1374 (
1375 l_api_name,
1376 G_PKG_NAME,
1377 'OKC_API.G_RET_STS_UNEXP_ERROR',
1378 x_msg_count,
1379 x_msg_data,
1380 '_PVT'
1381 );
1382 WHEN OTHERS THEN
1383 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1384 (
1385 l_api_name,
1386 G_PKG_NAME,
1387 'OTHERS',
1388 x_msg_count,
1389 x_msg_data,
1390 '_PVT'
1391 );
1392 END validate_row;
1393 ---------------------------------------------------------
1394 -- PL/SQL TBL validate_row for:OKL_TRX_SUBSIDY_POOLS_V --
1395 ---------------------------------------------------------
1396 PROCEDURE validate_row(
1397 p_api_version IN NUMBER,
1398 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1399 x_return_status OUT NOCOPY VARCHAR2,
1400 x_msg_count OUT NOCOPY NUMBER,
1401 x_msg_data OUT NOCOPY VARCHAR2,
1402 p_sixv_tbl IN sixv_tbl_type,
1403 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1404
1405 l_api_version CONSTANT NUMBER := 1;
1406 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_validate_row';
1407 i NUMBER := 0;
1408 BEGIN
1409 OKC_API.init_msg_list(p_init_msg_list);
1410 -- Make sure PL/SQL table has records in it before passing
1411 IF (p_sixv_tbl.COUNT > 0) THEN
1412 i := p_sixv_tbl.FIRST;
1413 LOOP
1414 DECLARE
1415 l_error_rec OKC_API.ERROR_REC_TYPE;
1416 BEGIN
1417 l_error_rec.api_name := l_api_name;
1418 l_error_rec.api_package := G_PKG_NAME;
1419 l_error_rec.idx := i;
1420 validate_row (
1421 p_api_version => p_api_version,
1422 p_init_msg_list => OKC_API.G_FALSE,
1423 x_return_status => l_error_rec.error_type,
1424 x_msg_count => l_error_rec.msg_count,
1425 x_msg_data => l_error_rec.msg_data,
1426 p_sixv_rec => p_sixv_tbl(i));
1427 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1428 l_error_rec.sqlcode := SQLCODE;
1429 load_error_tbl(l_error_rec, px_error_tbl);
1430 ELSE
1431 x_msg_count := l_error_rec.msg_count;
1432 x_msg_data := l_error_rec.msg_data;
1433 END IF;
1434 EXCEPTION
1435 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1436 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1437 l_error_rec.sqlcode := SQLCODE;
1438 load_error_tbl(l_error_rec, px_error_tbl);
1439 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1440 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1441 l_error_rec.sqlcode := SQLCODE;
1442 load_error_tbl(l_error_rec, px_error_tbl);
1443 WHEN OTHERS THEN
1444 l_error_rec.error_type := 'OTHERS';
1445 l_error_rec.sqlcode := SQLCODE;
1446 load_error_tbl(l_error_rec, px_error_tbl);
1447 END;
1448 EXIT WHEN (i = p_sixv_tbl.LAST);
1449 i := p_sixv_tbl.NEXT(i);
1450 END LOOP;
1451 END IF;
1452 -- Loop through the error_tbl to find the error with the highest severity
1453 -- and return it.
1454 x_return_status := find_highest_exception(px_error_tbl);
1455 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1456 EXCEPTION
1457 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1458 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1459 (
1460 l_api_name,
1461 G_PKG_NAME,
1462 'OKC_API.G_RET_STS_ERROR',
1463 x_msg_count,
1464 x_msg_data,
1465 '_PVT'
1466 );
1467 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1468 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1469 (
1470 l_api_name,
1471 G_PKG_NAME,
1472 'OKC_API.G_RET_STS_UNEXP_ERROR',
1473 x_msg_count,
1474 x_msg_data,
1475 '_PVT'
1476 );
1477 WHEN OTHERS THEN
1478 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1479 (
1480 l_api_name,
1481 G_PKG_NAME,
1482 'OTHERS',
1483 x_msg_count,
1484 x_msg_data,
1485 '_PVT'
1486 );
1487 END validate_row;
1488
1489 ---------------------------------------------------------
1490 -- PL/SQL TBL validate_row for:OKL_TRX_SUBSIDY_POOLS_V --
1491 ---------------------------------------------------------
1492 PROCEDURE validate_row(
1493 p_api_version IN NUMBER,
1494 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1495 x_return_status OUT NOCOPY VARCHAR2,
1496 x_msg_count OUT NOCOPY NUMBER,
1497 x_msg_data OUT NOCOPY VARCHAR2,
1498 p_sixv_tbl IN sixv_tbl_type) IS
1499
1500 l_api_version CONSTANT NUMBER := 1;
1501 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1502 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1503 l_error_tbl OKC_API.ERROR_TBL_TYPE;
1504 BEGIN
1505 OKC_API.init_msg_list(p_init_msg_list);
1506 -- Make sure PL/SQL table has records in it before passing
1507 IF (p_sixv_tbl.COUNT > 0) THEN
1508 validate_row (
1509 p_api_version => p_api_version,
1510 p_init_msg_list => OKC_API.G_FALSE,
1511 x_return_status => x_return_status,
1512 x_msg_count => x_msg_count,
1513 x_msg_data => x_msg_data,
1514 p_sixv_tbl => p_sixv_tbl,
1515 px_error_tbl => l_error_tbl);
1516 END IF;
1517 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1518 EXCEPTION
1519 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1520 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1521 (
1522 l_api_name,
1523 G_PKG_NAME,
1524 'OKC_API.G_RET_STS_ERROR',
1525 x_msg_count,
1526 x_msg_data,
1527 '_PVT'
1528 );
1529 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1530 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1531 (
1532 l_api_name,
1533 G_PKG_NAME,
1534 'OKC_API.G_RET_STS_UNEXP_ERROR',
1535 x_msg_count,
1536 x_msg_data,
1537 '_PVT'
1538 );
1539 WHEN OTHERS THEN
1540 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1541 (
1542 l_api_name,
1543 G_PKG_NAME,
1544 'OTHERS',
1545 x_msg_count,
1546 x_msg_data,
1547 '_PVT'
1548 );
1549 END validate_row;
1550
1551 ---------------------------------------------------------------------------
1552 -- PROCEDURE insert_row
1553 ---------------------------------------------------------------------------
1554 ------------------------------------------
1555 -- insert_row for:OKL_TRX_SUBSIDY_POOLS --
1556 ------------------------------------------
1557 PROCEDURE insert_row(
1558 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1559 x_return_status OUT NOCOPY VARCHAR2,
1560 x_msg_count OUT NOCOPY NUMBER,
1561 x_msg_data OUT NOCOPY VARCHAR2,
1562 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
1563 x_okl_trx_subsidy_pools_rec OUT NOCOPY okl_trx_subsidy_pools_rec_type) IS
1564
1565 l_api_version CONSTANT NUMBER := 1;
1566 l_api_name CONSTANT VARCHAR2(30) := 'B_insert_row';
1567 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1568 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type := p_okl_trx_subsidy_pools_rec;
1569 LDefOklTrxSubsidyPoolsRec okl_trx_subsidy_pools_rec_type;
1570 ----------------------------------------------
1571 -- Set_Attributes for:OKL_TRX_SUBSIDY_POOLS --
1572 ----------------------------------------------
1573 FUNCTION Set_Attributes (
1574 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
1575 x_okl_trx_subsidy_pools_rec OUT NOCOPY okl_trx_subsidy_pools_rec_type
1576 ) RETURN VARCHAR2 IS
1577 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1578 BEGIN
1579 x_okl_trx_subsidy_pools_rec := p_okl_trx_subsidy_pools_rec;
1580 RETURN(l_return_status);
1581 END Set_Attributes;
1582 BEGIN
1583 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1584 p_init_msg_list,
1585 '_PVT',
1586 x_return_status);
1587 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1588 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1589 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1590 RAISE OKC_API.G_EXCEPTION_ERROR;
1591 END IF;
1592 --- Setting item atributes
1593 l_return_status := Set_Attributes(
1594 p_okl_trx_subsidy_pools_rec, -- IN
1595 l_okl_trx_subsidy_pools_rec); -- OUT
1596 --- If any errors happen abort API
1597 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1598 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1599 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1600 RAISE OKC_API.G_EXCEPTION_ERROR;
1601 END IF;
1602 INSERT INTO OKL_TRX_SUBSIDY_POOLS(
1603 id,
1604 object_version_number,
1605 trx_type_code,
1606 source_type_code,
1607 source_object_id,
1608 subsidy_pool_id,
1609 dnz_asset_number,
1610 vendor_id,
1611 source_trx_date,
1612 trx_date,
1613 subsidy_id,
1614 trx_reason_code,
1615 trx_currency_code,
1616 trx_amount,
1617 subsidy_pool_currency_code,
1618 subsidy_pool_amount,
1619 conversion_rate,
1620 attribute_category,
1621 attribute1,
1622 attribute2,
1623 attribute3,
1624 attribute4,
1625 attribute5,
1626 attribute6,
1627 attribute7,
1628 attribute8,
1629 attribute9,
1630 attribute10,
1631 attribute11,
1632 attribute12,
1633 attribute13,
1634 attribute14,
1635 attribute15,
1636 created_by,
1637 creation_date,
1638 last_updated_by,
1639 last_update_date,
1640 last_update_login)
1641 VALUES (
1642 l_okl_trx_subsidy_pools_rec.id,
1643 l_okl_trx_subsidy_pools_rec.object_version_number,
1644 l_okl_trx_subsidy_pools_rec.trx_type_code,
1645 l_okl_trx_subsidy_pools_rec.source_type_code,
1646 l_okl_trx_subsidy_pools_rec.source_object_id,
1647 l_okl_trx_subsidy_pools_rec.subsidy_pool_id,
1648 l_okl_trx_subsidy_pools_rec.dnz_asset_number,
1649 l_okl_trx_subsidy_pools_rec.vendor_id,
1650 l_okl_trx_subsidy_pools_rec.source_trx_date,
1651 l_okl_trx_subsidy_pools_rec.trx_date,
1652 l_okl_trx_subsidy_pools_rec.subsidy_id,
1653 l_okl_trx_subsidy_pools_rec.trx_reason_code,
1654 l_okl_trx_subsidy_pools_rec.trx_currency_code,
1655 l_okl_trx_subsidy_pools_rec.trx_amount,
1656 l_okl_trx_subsidy_pools_rec.subsidy_pool_currency_code,
1657 l_okl_trx_subsidy_pools_rec.subsidy_pool_amount,
1658 l_okl_trx_subsidy_pools_rec.conversion_rate,
1659 l_okl_trx_subsidy_pools_rec.attribute_category,
1660 l_okl_trx_subsidy_pools_rec.attribute1,
1661 l_okl_trx_subsidy_pools_rec.attribute2,
1662 l_okl_trx_subsidy_pools_rec.attribute3,
1663 l_okl_trx_subsidy_pools_rec.attribute4,
1664 l_okl_trx_subsidy_pools_rec.attribute5,
1665 l_okl_trx_subsidy_pools_rec.attribute6,
1666 l_okl_trx_subsidy_pools_rec.attribute7,
1667 l_okl_trx_subsidy_pools_rec.attribute8,
1668 l_okl_trx_subsidy_pools_rec.attribute9,
1669 l_okl_trx_subsidy_pools_rec.attribute10,
1670 l_okl_trx_subsidy_pools_rec.attribute11,
1671 l_okl_trx_subsidy_pools_rec.attribute12,
1672 l_okl_trx_subsidy_pools_rec.attribute13,
1673 l_okl_trx_subsidy_pools_rec.attribute14,
1674 l_okl_trx_subsidy_pools_rec.attribute15,
1675 l_okl_trx_subsidy_pools_rec.created_by,
1676 l_okl_trx_subsidy_pools_rec.creation_date,
1677 l_okl_trx_subsidy_pools_rec.last_updated_by,
1678 l_okl_trx_subsidy_pools_rec.last_update_date,
1679 l_okl_trx_subsidy_pools_rec.last_update_login);
1680 -- Set OUT values
1681 x_okl_trx_subsidy_pools_rec := l_okl_trx_subsidy_pools_rec;
1682 x_return_status := l_return_status;
1683 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1684 EXCEPTION
1685 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1686 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1687 (
1688 l_api_name,
1689 G_PKG_NAME,
1690 'OKC_API.G_RET_STS_ERROR',
1691 x_msg_count,
1692 x_msg_data,
1693 '_PVT'
1694 );
1695 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1696 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1697 (
1698 l_api_name,
1699 G_PKG_NAME,
1700 'OKC_API.G_RET_STS_UNEXP_ERROR',
1701 x_msg_count,
1702 x_msg_data,
1703 '_PVT'
1704 );
1705 WHEN OTHERS THEN
1706 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1707 (
1708 l_api_name,
1709 G_PKG_NAME,
1710 'OTHERS',
1711 x_msg_count,
1712 x_msg_data,
1713 '_PVT'
1714 );
1715 END insert_row;
1716 ---------------------------------------------
1717 -- insert_row for :OKL_TRX_SUBSIDY_POOLS_V --
1718 ---------------------------------------------
1719 PROCEDURE insert_row(
1720 p_api_version IN NUMBER,
1721 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1722 x_return_status OUT NOCOPY VARCHAR2,
1723 x_msg_count OUT NOCOPY NUMBER,
1724 x_msg_data OUT NOCOPY VARCHAR2,
1725 p_sixv_rec IN sixv_rec_type,
1726 x_sixv_rec OUT NOCOPY sixv_rec_type) IS
1727
1728 l_api_version CONSTANT NUMBER := 1;
1729 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
1730 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1731 l_sixv_rec sixv_rec_type := p_sixv_rec;
1732 l_def_sixv_rec sixv_rec_type;
1733 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
1734 lx_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
1735 -------------------------------
1736 -- FUNCTION fill_who_columns --
1737 -------------------------------
1738 FUNCTION fill_who_columns (
1739 p_sixv_rec IN sixv_rec_type
1740 ) RETURN sixv_rec_type IS
1741 l_sixv_rec sixv_rec_type := p_sixv_rec;
1742 BEGIN
1743 l_sixv_rec.CREATION_DATE := SYSDATE;
1744 l_sixv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
1745 l_sixv_rec.LAST_UPDATE_DATE := l_sixv_rec.CREATION_DATE;
1746 l_sixv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1747 l_sixv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1748 RETURN(l_sixv_rec);
1749 END fill_who_columns;
1750 ------------------------------------------------
1751 -- Set_Attributes for:OKL_TRX_SUBSIDY_POOLS_V --
1752 ------------------------------------------------
1753 FUNCTION Set_Attributes (
1754 p_sixv_rec IN sixv_rec_type,
1755 x_sixv_rec OUT NOCOPY sixv_rec_type
1756 ) RETURN VARCHAR2 IS
1757 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1758 BEGIN
1759 x_sixv_rec := p_sixv_rec;
1760 x_sixv_rec.OBJECT_VERSION_NUMBER := 1;
1761 RETURN(l_return_status);
1762 END Set_Attributes;
1763 BEGIN
1764 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1765 G_PKG_NAME,
1766 p_init_msg_list,
1767 l_api_version,
1768 p_api_version,
1769 '_PVT',
1770 x_return_status);
1771 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1772 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1773 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1774 RAISE OKC_API.G_EXCEPTION_ERROR;
1775 END IF;
1776 l_sixv_rec := null_out_defaults(p_sixv_rec);
1777 -- Set primary key value
1778 l_sixv_rec.ID := get_seq_id;
1779 -- Setting item attributes
1780 l_return_Status := Set_Attributes(
1781 l_sixv_rec, -- IN
1782 l_def_sixv_rec); -- OUT
1783 --- If any errors happen abort API
1784 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1785 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1786 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1787 RAISE OKC_API.G_EXCEPTION_ERROR;
1788 END IF;
1789 l_def_sixv_rec := fill_who_columns(l_def_sixv_rec);
1790 --- Validate all non-missing attributes (Item Level Validation)
1791 l_return_status := Validate_Attributes(l_def_sixv_rec);
1792 --- If any errors happen abort API
1793 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1794 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1795 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1796 RAISE OKC_API.G_EXCEPTION_ERROR;
1797 END IF;
1798 l_return_status := Validate_Record(l_def_sixv_rec);
1799 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1800 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1801 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1802 RAISE OKC_API.G_EXCEPTION_ERROR;
1803 END IF;
1804 -----------------------------------------
1805 -- Move VIEW record to "Child" records --
1806 -----------------------------------------
1807 migrate(l_def_sixv_rec, l_okl_trx_subsidy_pools_rec);
1808 -----------------------------------------------
1809 -- Call the INSERT_ROW for each child record --
1810 -----------------------------------------------
1811 insert_row(
1812 p_init_msg_list,
1813 l_return_status,
1814 x_msg_count,
1815 x_msg_data,
1816 l_okl_trx_subsidy_pools_rec,
1817 lx_okl_trx_subsidy_pools_rec
1818 );
1819 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1820 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1821 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1822 RAISE OKC_API.G_EXCEPTION_ERROR;
1823 END IF;
1824 migrate(lx_okl_trx_subsidy_pools_rec, l_def_sixv_rec);
1825 -- Set OUT values
1826 x_sixv_rec := l_def_sixv_rec;
1827 x_return_status := l_return_status;
1828 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1829 EXCEPTION
1830 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1831 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1832 (
1833 l_api_name,
1834 G_PKG_NAME,
1835 'OKC_API.G_RET_STS_ERROR',
1836 x_msg_count,
1837 x_msg_data,
1838 '_PVT'
1839 );
1840 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1841 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1842 (
1843 l_api_name,
1844 G_PKG_NAME,
1845 'OKC_API.G_RET_STS_UNEXP_ERROR',
1846 x_msg_count,
1847 x_msg_data,
1848 '_PVT'
1849 );
1850 WHEN OTHERS THEN
1851 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1852 (
1853 l_api_name,
1854 G_PKG_NAME,
1855 'OTHERS',
1856 x_msg_count,
1857 x_msg_data,
1858 '_PVT'
1859 );
1860 END insert_row;
1861 ----------------------------------------
1862 -- PL/SQL TBL insert_row for:SIXV_TBL --
1863 ----------------------------------------
1864 PROCEDURE insert_row(
1865 p_api_version IN NUMBER,
1866 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1867 x_return_status OUT NOCOPY VARCHAR2,
1868 x_msg_count OUT NOCOPY NUMBER,
1869 x_msg_data OUT NOCOPY VARCHAR2,
1870 p_sixv_tbl IN sixv_tbl_type,
1871 x_sixv_tbl OUT NOCOPY sixv_tbl_type,
1872 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1873
1874 l_api_version CONSTANT NUMBER := 1;
1875 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_insert_row';
1876 i NUMBER := 0;
1877 BEGIN
1878 OKC_API.init_msg_list(p_init_msg_list);
1879 -- Make sure PL/SQL table has records in it before passing
1880 IF (p_sixv_tbl.COUNT > 0) THEN
1881 i := p_sixv_tbl.FIRST;
1882 LOOP
1883 DECLARE
1884 l_error_rec OKC_API.ERROR_REC_TYPE;
1885 BEGIN
1886 l_error_rec.api_name := l_api_name;
1887 l_error_rec.api_package := G_PKG_NAME;
1888 l_error_rec.idx := i;
1889 insert_row (
1890 p_api_version => p_api_version,
1891 p_init_msg_list => OKC_API.G_FALSE,
1892 x_return_status => l_error_rec.error_type,
1893 x_msg_count => l_error_rec.msg_count,
1894 x_msg_data => l_error_rec.msg_data,
1895 p_sixv_rec => p_sixv_tbl(i),
1896 x_sixv_rec => x_sixv_tbl(i));
1897 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1898 l_error_rec.sqlcode := SQLCODE;
1899 load_error_tbl(l_error_rec, px_error_tbl);
1900 ELSE
1901 x_msg_count := l_error_rec.msg_count;
1902 x_msg_data := l_error_rec.msg_data;
1903 END IF;
1904 EXCEPTION
1905 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1906 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1907 l_error_rec.sqlcode := SQLCODE;
1908 load_error_tbl(l_error_rec, px_error_tbl);
1909 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1910 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1911 l_error_rec.sqlcode := SQLCODE;
1912 load_error_tbl(l_error_rec, px_error_tbl);
1913 WHEN OTHERS THEN
1914 l_error_rec.error_type := 'OTHERS';
1915 l_error_rec.sqlcode := SQLCODE;
1916 load_error_tbl(l_error_rec, px_error_tbl);
1917 END;
1918 EXIT WHEN (i = p_sixv_tbl.LAST);
1919 i := p_sixv_tbl.NEXT(i);
1920 END LOOP;
1921 END IF;
1922 -- Loop through the error_tbl to find the error with the highest severity
1923 -- and return it.
1924 x_return_status := find_highest_exception(px_error_tbl);
1925 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1926 EXCEPTION
1927 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1928 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1929 (
1930 l_api_name,
1931 G_PKG_NAME,
1932 'OKC_API.G_RET_STS_ERROR',
1933 x_msg_count,
1934 x_msg_data,
1935 '_PVT'
1936 );
1937 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1938 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1939 (
1940 l_api_name,
1941 G_PKG_NAME,
1942 'OKC_API.G_RET_STS_UNEXP_ERROR',
1943 x_msg_count,
1944 x_msg_data,
1945 '_PVT'
1946 );
1947 WHEN OTHERS THEN
1948 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1949 (
1950 l_api_name,
1951 G_PKG_NAME,
1952 'OTHERS',
1953 x_msg_count,
1954 x_msg_data,
1955 '_PVT'
1956 );
1957 END insert_row;
1958
1959 ----------------------------------------
1960 -- PL/SQL TBL insert_row for:SIXV_TBL --
1961 ----------------------------------------
1962 PROCEDURE insert_row(
1963 p_api_version IN NUMBER,
1964 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1965 x_return_status OUT NOCOPY VARCHAR2,
1966 x_msg_count OUT NOCOPY NUMBER,
1967 x_msg_data OUT NOCOPY VARCHAR2,
1968 p_sixv_tbl IN sixv_tbl_type,
1969 x_sixv_tbl OUT NOCOPY sixv_tbl_type) IS
1970
1971 l_api_version CONSTANT NUMBER := 1;
1972 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1973 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1974 l_error_tbl OKC_API.ERROR_TBL_TYPE;
1975 BEGIN
1976 OKC_API.init_msg_list(p_init_msg_list);
1977 -- Make sure PL/SQL table has records in it before passing
1978 IF (p_sixv_tbl.COUNT > 0) THEN
1979 insert_row (
1980 p_api_version => p_api_version,
1981 p_init_msg_list => OKC_API.G_FALSE,
1982 x_return_status => x_return_status,
1983 x_msg_count => x_msg_count,
1984 x_msg_data => x_msg_data,
1985 p_sixv_tbl => p_sixv_tbl,
1986 x_sixv_tbl => x_sixv_tbl,
1987 px_error_tbl => l_error_tbl);
1988 END IF;
1989 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1990 EXCEPTION
1991 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1992 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1993 (
1994 l_api_name,
1995 G_PKG_NAME,
1996 'OKC_API.G_RET_STS_ERROR',
1997 x_msg_count,
1998 x_msg_data,
1999 '_PVT'
2000 );
2001 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2002 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2003 (
2004 l_api_name,
2005 G_PKG_NAME,
2006 'OKC_API.G_RET_STS_UNEXP_ERROR',
2007 x_msg_count,
2008 x_msg_data,
2009 '_PVT'
2010 );
2011 WHEN OTHERS THEN
2012 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2013 (
2014 l_api_name,
2015 G_PKG_NAME,
2016 'OTHERS',
2017 x_msg_count,
2018 x_msg_data,
2019 '_PVT'
2020 );
2021 END insert_row;
2022
2023 ---------------------------------------------------------------------------
2024 -- PROCEDURE lock_row
2025 ---------------------------------------------------------------------------
2026 ----------------------------------------
2027 -- lock_row for:OKL_TRX_SUBSIDY_POOLS --
2028 ----------------------------------------
2029 PROCEDURE lock_row(
2030 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2031 x_return_status OUT NOCOPY VARCHAR2,
2032 x_msg_count OUT NOCOPY NUMBER,
2033 x_msg_data OUT NOCOPY VARCHAR2,
2034 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type) IS
2035
2036 E_Resource_Busy EXCEPTION;
2037 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
2038 CURSOR lock_csr (p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type) IS
2039 SELECT OBJECT_VERSION_NUMBER
2040 FROM OKL_TRX_SUBSIDY_POOLS
2041 WHERE ID = p_okl_trx_subsidy_pools_rec.id
2042 AND OBJECT_VERSION_NUMBER = p_okl_trx_subsidy_pools_rec.object_version_number
2043 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
2044
2045 CURSOR lchk_csr (p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type) IS
2046 SELECT OBJECT_VERSION_NUMBER
2047 FROM OKL_TRX_SUBSIDY_POOLS
2048 WHERE ID = p_okl_trx_subsidy_pools_rec.id;
2049 l_api_version CONSTANT NUMBER := 1;
2050 l_api_name CONSTANT VARCHAR2(30) := 'B_lock_row';
2051 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2052 l_object_version_number OKL_TRX_SUBSIDY_POOLS.OBJECT_VERSION_NUMBER%TYPE;
2053 lc_object_version_number OKL_TRX_SUBSIDY_POOLS.OBJECT_VERSION_NUMBER%TYPE;
2054 l_row_notfound BOOLEAN := FALSE;
2055 lc_row_notfound BOOLEAN := FALSE;
2056 BEGIN
2057 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2058 p_init_msg_list,
2059 '_PVT',
2060 x_return_status);
2061 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2062 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2063 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2064 RAISE OKC_API.G_EXCEPTION_ERROR;
2065 END IF;
2066 BEGIN
2067 OPEN lock_csr(p_okl_trx_subsidy_pools_rec);
2068 FETCH lock_csr INTO l_object_version_number;
2069 l_row_notfound := lock_csr%NOTFOUND;
2070 CLOSE lock_csr;
2071 EXCEPTION
2072 WHEN E_Resource_Busy THEN
2073 IF (lock_csr%ISOPEN) THEN
2074 CLOSE lock_csr;
2075 END IF;
2076 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2077 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2078 END;
2079
2080 IF ( l_row_notfound ) THEN
2081 OPEN lchk_csr(p_okl_trx_subsidy_pools_rec);
2082 FETCH lchk_csr INTO lc_object_version_number;
2083 lc_row_notfound := lchk_csr%NOTFOUND;
2084 CLOSE lchk_csr;
2085 END IF;
2086 IF (lc_row_notfound) THEN
2087 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2088 RAISE OKC_API.G_EXCEPTION_ERROR;
2089 ELSIF lc_object_version_number > p_okl_trx_subsidy_pools_rec.object_version_number THEN
2090 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2091 RAISE OKC_API.G_EXCEPTION_ERROR;
2092 ELSIF lc_object_version_number <> p_okl_trx_subsidy_pools_rec.object_version_number THEN
2093 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2094 RAISE OKC_API.G_EXCEPTION_ERROR;
2095 ELSIF lc_object_version_number = -1 THEN
2096 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
2097 RAISE OKC_API.G_EXCEPTION_ERROR;
2098 END IF;
2099 x_return_status := l_return_status;
2100 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2101 EXCEPTION
2102 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2103 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2104 (
2105 l_api_name,
2106 G_PKG_NAME,
2107 'OKC_API.G_RET_STS_ERROR',
2108 x_msg_count,
2109 x_msg_data,
2110 '_PVT'
2111 );
2112 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2113 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2114 (
2115 l_api_name,
2116 G_PKG_NAME,
2117 'OKC_API.G_RET_STS_UNEXP_ERROR',
2118 x_msg_count,
2119 x_msg_data,
2120 '_PVT'
2121 );
2122 WHEN OTHERS THEN
2123 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2124 (
2125 l_api_name,
2126 G_PKG_NAME,
2127 'OTHERS',
2128 x_msg_count,
2129 x_msg_data,
2130 '_PVT'
2131 );
2132 END lock_row;
2133 -------------------------------------------
2134 -- lock_row for: OKL_TRX_SUBSIDY_POOLS_V --
2135 -------------------------------------------
2136 PROCEDURE lock_row(
2137 p_api_version IN NUMBER,
2138 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2139 x_return_status OUT NOCOPY VARCHAR2,
2140 x_msg_count OUT NOCOPY NUMBER,
2141 x_msg_data OUT NOCOPY VARCHAR2,
2142 p_sixv_rec IN sixv_rec_type) IS
2143
2144 l_api_version CONSTANT NUMBER := 1;
2145 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
2146 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2147 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
2148 BEGIN
2149 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2150 G_PKG_NAME,
2151 p_init_msg_list,
2152 l_api_version,
2153 p_api_version,
2154 '_PVT',
2155 x_return_status);
2156 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2157 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2158 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2159 RAISE OKC_API.G_EXCEPTION_ERROR;
2160 END IF;
2161 -----------------------------------------
2162 -- Move VIEW record to "Child" records --
2163 -----------------------------------------
2164 migrate(p_sixv_rec, l_okl_trx_subsidy_pools_rec);
2165 ---------------------------------------------
2166 -- Call the LOCK_ROW for each child record --
2167 ---------------------------------------------
2168 lock_row(
2169 p_init_msg_list,
2170 l_return_status,
2171 x_msg_count,
2172 x_msg_data,
2173 l_okl_trx_subsidy_pools_rec
2174 );
2175 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2176 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2177 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2178 RAISE OKC_API.G_EXCEPTION_ERROR;
2179 END IF;
2180 x_return_status := l_return_status;
2181 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2182 EXCEPTION
2183 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2184 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2185 (
2186 l_api_name,
2187 G_PKG_NAME,
2188 'OKC_API.G_RET_STS_ERROR',
2189 x_msg_count,
2190 x_msg_data,
2191 '_PVT'
2192 );
2193 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2194 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2195 (
2196 l_api_name,
2197 G_PKG_NAME,
2198 'OKC_API.G_RET_STS_UNEXP_ERROR',
2199 x_msg_count,
2200 x_msg_data,
2201 '_PVT'
2202 );
2203 WHEN OTHERS THEN
2204 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2205 (
2206 l_api_name,
2207 G_PKG_NAME,
2208 'OTHERS',
2209 x_msg_count,
2210 x_msg_data,
2211 '_PVT'
2212 );
2213 END lock_row;
2214 --------------------------------------
2215 -- PL/SQL TBL lock_row for:SIXV_TBL --
2216 --------------------------------------
2217 PROCEDURE lock_row(
2218 p_api_version IN NUMBER,
2219 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2220 x_return_status OUT NOCOPY VARCHAR2,
2221 x_msg_count OUT NOCOPY NUMBER,
2222 x_msg_data OUT NOCOPY VARCHAR2,
2223 p_sixv_tbl IN sixv_tbl_type,
2224 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
2225
2226 l_api_version CONSTANT NUMBER := 1;
2227 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_lock_row';
2228 i NUMBER := 0;
2229 BEGIN
2230 OKC_API.init_msg_list(p_init_msg_list);
2231 -- Make sure PL/SQL table has recrods in it before passing
2232 IF (p_sixv_tbl.COUNT > 0) THEN
2233 i := p_sixv_tbl.FIRST;
2234 LOOP
2235 DECLARE
2236 l_error_rec OKC_API.ERROR_REC_TYPE;
2237 BEGIN
2238 l_error_rec.api_name := l_api_name;
2239 l_error_rec.api_package := G_PKG_NAME;
2240 l_error_rec.idx := i;
2241 lock_row(
2242 p_api_version => p_api_version,
2243 p_init_msg_list => OKC_API.G_FALSE,
2244 x_return_status => l_error_rec.error_type,
2245 x_msg_count => l_error_rec.msg_count,
2246 x_msg_data => l_error_rec.msg_data,
2247 p_sixv_rec => p_sixv_tbl(i));
2248 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
2249 l_error_rec.sqlcode := SQLCODE;
2250 load_error_tbl(l_error_rec, px_error_tbl);
2251 ELSE
2252 x_msg_count := l_error_rec.msg_count;
2253 x_msg_data := l_error_rec.msg_data;
2254 END IF;
2255 EXCEPTION
2256 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2257 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2258 l_error_rec.sqlcode := SQLCODE;
2259 load_error_tbl(l_error_rec, px_error_tbl);
2260 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2261 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2262 l_error_rec.sqlcode := SQLCODE;
2263 load_error_tbl(l_error_rec, px_error_tbl);
2264 WHEN OTHERS THEN
2265 l_error_rec.error_type := 'OTHERS';
2266 l_error_rec.sqlcode := SQLCODE;
2267 load_error_tbl(l_error_rec, px_error_tbl);
2268 END;
2269 EXIT WHEN (i = p_sixv_tbl.LAST);
2270 i := p_sixv_tbl.NEXT(i);
2271 END LOOP;
2272 END IF;
2273 -- Loop through the error_tbl to find the error with the highest severity
2274 -- and return it.
2275 x_return_status := find_highest_exception(px_error_tbl);
2276 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2277 EXCEPTION
2278 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2279 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2280 (
2281 l_api_name,
2282 G_PKG_NAME,
2283 'OKC_API.G_RET_STS_ERROR',
2284 x_msg_count,
2285 x_msg_data,
2286 '_PVT'
2287 );
2288 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2289 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2290 (
2291 l_api_name,
2292 G_PKG_NAME,
2293 'OKC_API.G_RET_STS_UNEXP_ERROR',
2294 x_msg_count,
2295 x_msg_data,
2296 '_PVT'
2297 );
2298 WHEN OTHERS THEN
2299 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2300 (
2301 l_api_name,
2302 G_PKG_NAME,
2303 'OTHERS',
2304 x_msg_count,
2305 x_msg_data,
2306 '_PVT'
2307 );
2308 END lock_row;
2309 --------------------------------------
2310 -- PL/SQL TBL lock_row for:SIXV_TBL --
2311 --------------------------------------
2312 PROCEDURE lock_row(
2313 p_api_version IN NUMBER,
2314 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2315 x_return_status OUT NOCOPY VARCHAR2,
2316 x_msg_count OUT NOCOPY NUMBER,
2317 x_msg_data OUT NOCOPY VARCHAR2,
2318 p_sixv_tbl IN sixv_tbl_type) IS
2319
2320 l_api_version CONSTANT NUMBER := 1;
2321 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
2322 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2323 l_error_tbl OKC_API.ERROR_TBL_TYPE;
2324 BEGIN
2325 OKC_API.init_msg_list(p_init_msg_list);
2326 -- Make sure PL/SQL table has recrods in it before passing
2327 IF (p_sixv_tbl.COUNT > 0) THEN
2328 lock_row(
2329 p_api_version => p_api_version,
2330 p_init_msg_list => OKC_API.G_FALSE,
2331 x_return_status => x_return_status,
2332 x_msg_count => x_msg_count,
2333 x_msg_data => x_msg_data,
2334 p_sixv_tbl => p_sixv_tbl,
2335 px_error_tbl => l_error_tbl);
2336 END IF;
2337 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2338 EXCEPTION
2339 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2340 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2341 (
2342 l_api_name,
2343 G_PKG_NAME,
2344 'OKC_API.G_RET_STS_ERROR',
2345 x_msg_count,
2346 x_msg_data,
2347 '_PVT'
2348 );
2349 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2350 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2351 (
2352 l_api_name,
2353 G_PKG_NAME,
2354 'OKC_API.G_RET_STS_UNEXP_ERROR',
2355 x_msg_count,
2356 x_msg_data,
2357 '_PVT'
2358 );
2359 WHEN OTHERS THEN
2360 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2361 (
2362 l_api_name,
2363 G_PKG_NAME,
2364 'OTHERS',
2365 x_msg_count,
2366 x_msg_data,
2367 '_PVT'
2368 );
2369 END lock_row;
2370 ---------------------------------------------------------------------------
2371 -- PROCEDURE update_row
2372 ---------------------------------------------------------------------------
2373 ------------------------------------------
2374 -- update_row for:OKL_TRX_SUBSIDY_POOLS --
2375 ------------------------------------------
2376 PROCEDURE update_row(
2377 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2378 x_return_status OUT NOCOPY VARCHAR2,
2379 x_msg_count OUT NOCOPY NUMBER,
2380 x_msg_data OUT NOCOPY VARCHAR2,
2381 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
2382 x_okl_trx_subsidy_pools_rec OUT NOCOPY okl_trx_subsidy_pools_rec_type) IS
2383
2384 l_api_version CONSTANT NUMBER := 1;
2385 l_api_name CONSTANT VARCHAR2(30) := 'B_update_row';
2386 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2387 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type := p_okl_trx_subsidy_pools_rec;
2388 LDefOklTrxSubsidyPoolsRec okl_trx_subsidy_pools_rec_type;
2389 l_row_notfound BOOLEAN := TRUE;
2390 ----------------------------------
2391 -- FUNCTION populate_new_record --
2392 ----------------------------------
2393 FUNCTION populate_new_record (
2394 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
2395 x_okl_trx_subsidy_pools_rec OUT NOCOPY okl_trx_subsidy_pools_rec_type
2396 ) RETURN VARCHAR2 IS
2397 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
2398 l_row_notfound BOOLEAN := TRUE;
2399 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2400 BEGIN
2401 x_okl_trx_subsidy_pools_rec := p_okl_trx_subsidy_pools_rec;
2402 -- Get current database values
2403 l_okl_trx_subsidy_pools_rec := get_rec(p_okl_trx_subsidy_pools_rec, l_return_status);
2404 IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2405 IF (x_okl_trx_subsidy_pools_rec.id = OKC_API.G_MISS_NUM)
2406 THEN
2407 x_okl_trx_subsidy_pools_rec.id := l_okl_trx_subsidy_pools_rec.id;
2408 END IF;
2409 IF (x_okl_trx_subsidy_pools_rec.object_version_number = OKC_API.G_MISS_NUM)
2410 THEN
2411 x_okl_trx_subsidy_pools_rec.object_version_number := l_okl_trx_subsidy_pools_rec.object_version_number;
2412 END IF;
2413 IF (x_okl_trx_subsidy_pools_rec.trx_type_code = OKC_API.G_MISS_CHAR)
2414 THEN
2415 x_okl_trx_subsidy_pools_rec.trx_type_code := l_okl_trx_subsidy_pools_rec.trx_type_code;
2416 END IF;
2417 IF (x_okl_trx_subsidy_pools_rec.source_type_code = OKC_API.G_MISS_CHAR)
2418 THEN
2419 x_okl_trx_subsidy_pools_rec.source_type_code := l_okl_trx_subsidy_pools_rec.source_type_code;
2420 END IF;
2421 IF (x_okl_trx_subsidy_pools_rec.source_object_id = OKC_API.G_MISS_NUM)
2422 THEN
2423 x_okl_trx_subsidy_pools_rec.source_object_id := l_okl_trx_subsidy_pools_rec.source_object_id;
2424 END IF;
2425 IF (x_okl_trx_subsidy_pools_rec.subsidy_pool_id = OKC_API.G_MISS_NUM)
2426 THEN
2427 x_okl_trx_subsidy_pools_rec.subsidy_pool_id := l_okl_trx_subsidy_pools_rec.subsidy_pool_id;
2428 END IF;
2429 IF (x_okl_trx_subsidy_pools_rec.dnz_asset_number = OKC_API.G_MISS_CHAR)
2430 THEN
2431 x_okl_trx_subsidy_pools_rec.dnz_asset_number := l_okl_trx_subsidy_pools_rec.dnz_asset_number;
2432 END IF;
2433 IF (x_okl_trx_subsidy_pools_rec.vendor_id = OKC_API.G_MISS_NUM)
2434 THEN
2435 x_okl_trx_subsidy_pools_rec.vendor_id := l_okl_trx_subsidy_pools_rec.vendor_id;
2436 END IF;
2437 IF (x_okl_trx_subsidy_pools_rec.source_trx_date = OKC_API.G_MISS_DATE)
2438 THEN
2439 x_okl_trx_subsidy_pools_rec.source_trx_date := l_okl_trx_subsidy_pools_rec.source_trx_date;
2440 END IF;
2441 IF (x_okl_trx_subsidy_pools_rec.trx_date = OKC_API.G_MISS_DATE)
2442 THEN
2443 x_okl_trx_subsidy_pools_rec.trx_date := l_okl_trx_subsidy_pools_rec.trx_date;
2444 END IF;
2445 IF (x_okl_trx_subsidy_pools_rec.subsidy_id = OKC_API.G_MISS_NUM)
2446 THEN
2447 x_okl_trx_subsidy_pools_rec.subsidy_id := l_okl_trx_subsidy_pools_rec.subsidy_id;
2448 END IF;
2449 IF (x_okl_trx_subsidy_pools_rec.trx_reason_code = OKC_API.G_MISS_CHAR)
2450 THEN
2451 x_okl_trx_subsidy_pools_rec.trx_reason_code := l_okl_trx_subsidy_pools_rec.trx_reason_code;
2452 END IF;
2453 IF (x_okl_trx_subsidy_pools_rec.trx_currency_code = OKC_API.G_MISS_CHAR)
2454 THEN
2455 x_okl_trx_subsidy_pools_rec.trx_currency_code := l_okl_trx_subsidy_pools_rec.trx_currency_code;
2456 END IF;
2457 IF (x_okl_trx_subsidy_pools_rec.trx_amount = OKC_API.G_MISS_NUM)
2458 THEN
2459 x_okl_trx_subsidy_pools_rec.trx_amount := l_okl_trx_subsidy_pools_rec.trx_amount;
2460 END IF;
2461 IF (x_okl_trx_subsidy_pools_rec.subsidy_pool_currency_code = OKC_API.G_MISS_CHAR)
2462 THEN
2463 x_okl_trx_subsidy_pools_rec.subsidy_pool_currency_code := l_okl_trx_subsidy_pools_rec.subsidy_pool_currency_code;
2464 END IF;
2465 IF (x_okl_trx_subsidy_pools_rec.subsidy_pool_amount = OKC_API.G_MISS_NUM)
2466 THEN
2467 x_okl_trx_subsidy_pools_rec.subsidy_pool_amount := l_okl_trx_subsidy_pools_rec.subsidy_pool_amount;
2468 END IF;
2469 IF (x_okl_trx_subsidy_pools_rec.conversion_rate = OKC_API.G_MISS_NUM)
2470 THEN
2471 x_okl_trx_subsidy_pools_rec.conversion_rate := l_okl_trx_subsidy_pools_rec.conversion_rate;
2472 END IF;
2473 IF (x_okl_trx_subsidy_pools_rec.attribute_category = OKC_API.G_MISS_CHAR)
2474 THEN
2475 x_okl_trx_subsidy_pools_rec.attribute_category := l_okl_trx_subsidy_pools_rec.attribute_category;
2476 END IF;
2477 IF (x_okl_trx_subsidy_pools_rec.attribute1 = OKC_API.G_MISS_CHAR)
2478 THEN
2479 x_okl_trx_subsidy_pools_rec.attribute1 := l_okl_trx_subsidy_pools_rec.attribute1;
2480 END IF;
2481 IF (x_okl_trx_subsidy_pools_rec.attribute2 = OKC_API.G_MISS_CHAR)
2482 THEN
2483 x_okl_trx_subsidy_pools_rec.attribute2 := l_okl_trx_subsidy_pools_rec.attribute2;
2484 END IF;
2485 IF (x_okl_trx_subsidy_pools_rec.attribute3 = OKC_API.G_MISS_CHAR)
2486 THEN
2487 x_okl_trx_subsidy_pools_rec.attribute3 := l_okl_trx_subsidy_pools_rec.attribute3;
2488 END IF;
2489 IF (x_okl_trx_subsidy_pools_rec.attribute4 = OKC_API.G_MISS_CHAR)
2490 THEN
2491 x_okl_trx_subsidy_pools_rec.attribute4 := l_okl_trx_subsidy_pools_rec.attribute4;
2492 END IF;
2493 IF (x_okl_trx_subsidy_pools_rec.attribute5 = OKC_API.G_MISS_CHAR)
2494 THEN
2495 x_okl_trx_subsidy_pools_rec.attribute5 := l_okl_trx_subsidy_pools_rec.attribute5;
2496 END IF;
2497 IF (x_okl_trx_subsidy_pools_rec.attribute6 = OKC_API.G_MISS_CHAR)
2498 THEN
2499 x_okl_trx_subsidy_pools_rec.attribute6 := l_okl_trx_subsidy_pools_rec.attribute6;
2500 END IF;
2501 IF (x_okl_trx_subsidy_pools_rec.attribute7 = OKC_API.G_MISS_CHAR)
2502 THEN
2503 x_okl_trx_subsidy_pools_rec.attribute7 := l_okl_trx_subsidy_pools_rec.attribute7;
2504 END IF;
2505 IF (x_okl_trx_subsidy_pools_rec.attribute8 = OKC_API.G_MISS_CHAR)
2506 THEN
2507 x_okl_trx_subsidy_pools_rec.attribute8 := l_okl_trx_subsidy_pools_rec.attribute8;
2508 END IF;
2509 IF (x_okl_trx_subsidy_pools_rec.attribute9 = OKC_API.G_MISS_CHAR)
2510 THEN
2511 x_okl_trx_subsidy_pools_rec.attribute9 := l_okl_trx_subsidy_pools_rec.attribute9;
2512 END IF;
2513 IF (x_okl_trx_subsidy_pools_rec.attribute10 = OKC_API.G_MISS_CHAR)
2514 THEN
2515 x_okl_trx_subsidy_pools_rec.attribute10 := l_okl_trx_subsidy_pools_rec.attribute10;
2516 END IF;
2517 IF (x_okl_trx_subsidy_pools_rec.attribute11 = OKC_API.G_MISS_CHAR)
2518 THEN
2519 x_okl_trx_subsidy_pools_rec.attribute11 := l_okl_trx_subsidy_pools_rec.attribute11;
2520 END IF;
2521 IF (x_okl_trx_subsidy_pools_rec.attribute12 = OKC_API.G_MISS_CHAR)
2522 THEN
2523 x_okl_trx_subsidy_pools_rec.attribute12 := l_okl_trx_subsidy_pools_rec.attribute12;
2524 END IF;
2525 IF (x_okl_trx_subsidy_pools_rec.attribute13 = OKC_API.G_MISS_CHAR)
2526 THEN
2527 x_okl_trx_subsidy_pools_rec.attribute13 := l_okl_trx_subsidy_pools_rec.attribute13;
2528 END IF;
2529 IF (x_okl_trx_subsidy_pools_rec.attribute14 = OKC_API.G_MISS_CHAR)
2530 THEN
2531 x_okl_trx_subsidy_pools_rec.attribute14 := l_okl_trx_subsidy_pools_rec.attribute14;
2532 END IF;
2533 IF (x_okl_trx_subsidy_pools_rec.attribute15 = OKC_API.G_MISS_CHAR)
2534 THEN
2535 x_okl_trx_subsidy_pools_rec.attribute15 := l_okl_trx_subsidy_pools_rec.attribute15;
2536 END IF;
2537 IF (x_okl_trx_subsidy_pools_rec.created_by = OKC_API.G_MISS_NUM)
2538 THEN
2539 x_okl_trx_subsidy_pools_rec.created_by := l_okl_trx_subsidy_pools_rec.created_by;
2540 END IF;
2541 IF (x_okl_trx_subsidy_pools_rec.creation_date = OKC_API.G_MISS_DATE)
2542 THEN
2543 x_okl_trx_subsidy_pools_rec.creation_date := l_okl_trx_subsidy_pools_rec.creation_date;
2544 END IF;
2545 IF (x_okl_trx_subsidy_pools_rec.last_updated_by = OKC_API.G_MISS_NUM)
2546 THEN
2547 x_okl_trx_subsidy_pools_rec.last_updated_by := l_okl_trx_subsidy_pools_rec.last_updated_by;
2548 END IF;
2549 IF (x_okl_trx_subsidy_pools_rec.last_update_date = OKC_API.G_MISS_DATE)
2550 THEN
2551 x_okl_trx_subsidy_pools_rec.last_update_date := l_okl_trx_subsidy_pools_rec.last_update_date;
2552 END IF;
2553 IF (x_okl_trx_subsidy_pools_rec.last_update_login = OKC_API.G_MISS_NUM)
2554 THEN
2555 x_okl_trx_subsidy_pools_rec.last_update_login := l_okl_trx_subsidy_pools_rec.last_update_login;
2556 END IF;
2557 END IF;
2558 RETURN(l_return_status);
2559 END populate_new_record;
2560 ----------------------------------------------
2561 -- Set_Attributes for:OKL_TRX_SUBSIDY_POOLS --
2562 ----------------------------------------------
2563 FUNCTION Set_Attributes (
2564 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type,
2565 x_okl_trx_subsidy_pools_rec OUT NOCOPY okl_trx_subsidy_pools_rec_type
2566 ) RETURN VARCHAR2 IS
2567 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2568 BEGIN
2569 x_okl_trx_subsidy_pools_rec := p_okl_trx_subsidy_pools_rec;
2570 x_okl_trx_subsidy_pools_rec.OBJECT_VERSION_NUMBER := p_okl_trx_subsidy_pools_rec.OBJECT_VERSION_NUMBER + 1;
2571 RETURN(l_return_status);
2572 END Set_Attributes;
2573 BEGIN
2574 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2575 p_init_msg_list,
2576 '_PVT',
2577 x_return_status);
2578 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2579 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2580 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2581 RAISE OKC_API.G_EXCEPTION_ERROR;
2582 END IF;
2583 --- Setting item attributes
2584 l_return_status := Set_Attributes(
2585 p_okl_trx_subsidy_pools_rec, -- IN
2586 l_okl_trx_subsidy_pools_rec); -- OUT
2587 --- If any errors happen abort API
2588 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2589 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2590 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2591 RAISE OKC_API.G_EXCEPTION_ERROR;
2592 END IF;
2593 l_return_status := populate_new_record(l_okl_trx_subsidy_pools_rec, LDefOklTrxSubsidyPoolsRec);
2594 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2595 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2596 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2597 RAISE OKC_API.G_EXCEPTION_ERROR;
2598 END IF;
2599 UPDATE OKL_TRX_SUBSIDY_POOLS
2600 SET OBJECT_VERSION_NUMBER = LDefOklTrxSubsidyPoolsRec.object_version_number,
2601 TRX_TYPE_CODE = LDefOklTrxSubsidyPoolsRec.trx_type_code,
2602 SOURCE_TYPE_CODE = LDefOklTrxSubsidyPoolsRec.source_type_code,
2603 SOURCE_OBJECT_ID = LDefOklTrxSubsidyPoolsRec.source_object_id,
2604 SUBSIDY_POOL_ID = LDefOklTrxSubsidyPoolsRec.subsidy_pool_id,
2605 DNZ_ASSET_NUMBER = LDefOklTrxSubsidyPoolsRec.dnz_asset_number,
2606 VENDOR_ID = LDefOklTrxSubsidyPoolsRec.vendor_id,
2607 SOURCE_TRX_DATE = LDefOklTrxSubsidyPoolsRec.source_trx_date,
2608 TRX_DATE = LDefOklTrxSubsidyPoolsRec.trx_date,
2609 SUBSIDY_ID = LDefOklTrxSubsidyPoolsRec.subsidy_id,
2610 TRX_REASON_CODE = LDefOklTrxSubsidyPoolsRec.trx_reason_code,
2611 TRX_CURRENCY_CODE = LDefOklTrxSubsidyPoolsRec.trx_currency_code,
2612 TRX_AMOUNT = LDefOklTrxSubsidyPoolsRec.trx_amount,
2613 SUBSIDY_POOL_CURRENCY_CODE = LDefOklTrxSubsidyPoolsRec.subsidy_pool_currency_code,
2614 SUBSIDY_POOL_AMOUNT = LDefOklTrxSubsidyPoolsRec.subsidy_pool_amount,
2615 CONVERSION_RATE = LDefOklTrxSubsidyPoolsRec.conversion_rate,
2616 ATTRIBUTE_CATEGORY = LDefOklTrxSubsidyPoolsRec.attribute_category,
2617 ATTRIBUTE1 = LDefOklTrxSubsidyPoolsRec.attribute1,
2618 ATTRIBUTE2 = LDefOklTrxSubsidyPoolsRec.attribute2,
2619 ATTRIBUTE3 = LDefOklTrxSubsidyPoolsRec.attribute3,
2620 ATTRIBUTE4 = LDefOklTrxSubsidyPoolsRec.attribute4,
2621 ATTRIBUTE5 = LDefOklTrxSubsidyPoolsRec.attribute5,
2622 ATTRIBUTE6 = LDefOklTrxSubsidyPoolsRec.attribute6,
2623 ATTRIBUTE7 = LDefOklTrxSubsidyPoolsRec.attribute7,
2624 ATTRIBUTE8 = LDefOklTrxSubsidyPoolsRec.attribute8,
2625 ATTRIBUTE9 = LDefOklTrxSubsidyPoolsRec.attribute9,
2626 ATTRIBUTE10 = LDefOklTrxSubsidyPoolsRec.attribute10,
2627 ATTRIBUTE11 = LDefOklTrxSubsidyPoolsRec.attribute11,
2628 ATTRIBUTE12 = LDefOklTrxSubsidyPoolsRec.attribute12,
2629 ATTRIBUTE13 = LDefOklTrxSubsidyPoolsRec.attribute13,
2630 ATTRIBUTE14 = LDefOklTrxSubsidyPoolsRec.attribute14,
2631 ATTRIBUTE15 = LDefOklTrxSubsidyPoolsRec.attribute15,
2632 CREATED_BY = LDefOklTrxSubsidyPoolsRec.created_by,
2633 CREATION_DATE = LDefOklTrxSubsidyPoolsRec.creation_date,
2634 LAST_UPDATED_BY = LDefOklTrxSubsidyPoolsRec.last_updated_by,
2635 LAST_UPDATE_DATE = LDefOklTrxSubsidyPoolsRec.last_update_date,
2636 LAST_UPDATE_LOGIN = LDefOklTrxSubsidyPoolsRec.last_update_login
2637 WHERE ID = LDefOklTrxSubsidyPoolsRec.id;
2638
2639 x_okl_trx_subsidy_pools_rec := l_okl_trx_subsidy_pools_rec;
2640 x_return_status := l_return_status;
2641 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2642 EXCEPTION
2643 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2644 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2645 (
2646 l_api_name,
2647 G_PKG_NAME,
2648 'OKC_API.G_RET_STS_ERROR',
2649 x_msg_count,
2650 x_msg_data,
2651 '_PVT'
2652 );
2653 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2654 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2655 (
2656 l_api_name,
2657 G_PKG_NAME,
2658 'OKC_API.G_RET_STS_UNEXP_ERROR',
2659 x_msg_count,
2660 x_msg_data,
2661 '_PVT'
2662 );
2663 WHEN OTHERS THEN
2664 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2665 (
2666 l_api_name,
2667 G_PKG_NAME,
2668 'OTHERS',
2669 x_msg_count,
2670 x_msg_data,
2671 '_PVT'
2672 );
2673 END update_row;
2674 --------------------------------------------
2675 -- update_row for:OKL_TRX_SUBSIDY_POOLS_V --
2676 --------------------------------------------
2677 PROCEDURE update_row(
2678 p_api_version IN NUMBER,
2679 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2680 x_return_status OUT NOCOPY VARCHAR2,
2681 x_msg_count OUT NOCOPY NUMBER,
2682 x_msg_data OUT NOCOPY VARCHAR2,
2683 p_sixv_rec IN sixv_rec_type,
2684 x_sixv_rec OUT NOCOPY sixv_rec_type) IS
2685
2686 l_api_version CONSTANT NUMBER := 1;
2687 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
2688 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2689 l_sixv_rec sixv_rec_type := p_sixv_rec;
2690 l_def_sixv_rec sixv_rec_type;
2691 l_db_sixv_rec sixv_rec_type;
2692 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
2693 lx_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
2694 -------------------------------
2695 -- FUNCTION fill_who_columns --
2696 -------------------------------
2697 FUNCTION fill_who_columns (
2698 p_sixv_rec IN sixv_rec_type
2699 ) RETURN sixv_rec_type IS
2700 l_sixv_rec sixv_rec_type := p_sixv_rec;
2701 BEGIN
2702 l_sixv_rec.LAST_UPDATE_DATE := SYSDATE;
2703 l_sixv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
2704 l_sixv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
2705 RETURN(l_sixv_rec);
2706 END fill_who_columns;
2707 ----------------------------------
2708 -- FUNCTION populate_new_record --
2709 ----------------------------------
2710 FUNCTION populate_new_record (
2711 p_sixv_rec IN sixv_rec_type,
2712 x_sixv_rec OUT NOCOPY sixv_rec_type
2713 ) RETURN VARCHAR2 IS
2714 l_row_notfound BOOLEAN := TRUE;
2715 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2716 BEGIN
2717 x_sixv_rec := p_sixv_rec;
2718 -- Get current database values
2719 -- NOTE: Never assign the OBJECT_VERSION_NUMBER. Force the user to pass it
2720 -- so it may be verified through LOCK_ROW.
2721 l_db_sixv_rec := get_rec(p_sixv_rec, l_return_status);
2722 IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2723 IF (x_sixv_rec.id = OKC_API.G_MISS_NUM)
2724 THEN
2725 x_sixv_rec.id := l_db_sixv_rec.id;
2726 END IF;
2727 IF (x_sixv_rec.trx_type_code = OKC_API.G_MISS_CHAR)
2728 THEN
2729 x_sixv_rec.trx_type_code := l_db_sixv_rec.trx_type_code;
2730 END IF;
2731 IF (x_sixv_rec.source_type_code = OKC_API.G_MISS_CHAR)
2732 THEN
2733 x_sixv_rec.source_type_code := l_db_sixv_rec.source_type_code;
2734 END IF;
2735 IF (x_sixv_rec.source_object_id = OKC_API.G_MISS_NUM)
2736 THEN
2737 x_sixv_rec.source_object_id := l_db_sixv_rec.source_object_id;
2738 END IF;
2739 IF (x_sixv_rec.subsidy_pool_id = OKC_API.G_MISS_NUM)
2740 THEN
2741 x_sixv_rec.subsidy_pool_id := l_db_sixv_rec.subsidy_pool_id;
2742 END IF;
2743 IF (x_sixv_rec.dnz_asset_number = OKC_API.G_MISS_CHAR)
2744 THEN
2745 x_sixv_rec.dnz_asset_number := l_db_sixv_rec.dnz_asset_number;
2746 END IF;
2747 IF (x_sixv_rec.vendor_id = OKC_API.G_MISS_NUM)
2748 THEN
2749 x_sixv_rec.vendor_id := l_db_sixv_rec.vendor_id;
2750 END IF;
2751 IF (x_sixv_rec.source_trx_date = OKC_API.G_MISS_DATE)
2752 THEN
2753 x_sixv_rec.source_trx_date := l_db_sixv_rec.source_trx_date;
2754 END IF;
2755 IF (x_sixv_rec.trx_date = OKC_API.G_MISS_DATE)
2756 THEN
2757 x_sixv_rec.trx_date := l_db_sixv_rec.trx_date;
2758 END IF;
2759 IF (x_sixv_rec.subsidy_id = OKC_API.G_MISS_NUM)
2760 THEN
2761 x_sixv_rec.subsidy_id := l_db_sixv_rec.subsidy_id;
2762 END IF;
2763 IF (x_sixv_rec.trx_reason_code = OKC_API.G_MISS_CHAR)
2764 THEN
2765 x_sixv_rec.trx_reason_code := l_db_sixv_rec.trx_reason_code;
2766 END IF;
2767 IF (x_sixv_rec.trx_currency_code = OKC_API.G_MISS_CHAR)
2768 THEN
2769 x_sixv_rec.trx_currency_code := l_db_sixv_rec.trx_currency_code;
2770 END IF;
2771 IF (x_sixv_rec.trx_amount = OKC_API.G_MISS_NUM)
2772 THEN
2773 x_sixv_rec.trx_amount := l_db_sixv_rec.trx_amount;
2774 END IF;
2775 IF (x_sixv_rec.subsidy_pool_currency_code = OKC_API.G_MISS_CHAR)
2776 THEN
2777 x_sixv_rec.subsidy_pool_currency_code := l_db_sixv_rec.subsidy_pool_currency_code;
2778 END IF;
2779 IF (x_sixv_rec.subsidy_pool_amount = OKC_API.G_MISS_NUM)
2780 THEN
2781 x_sixv_rec.subsidy_pool_amount := l_db_sixv_rec.subsidy_pool_amount;
2782 END IF;
2783 IF (x_sixv_rec.conversion_rate = OKC_API.G_MISS_NUM)
2784 THEN
2785 x_sixv_rec.conversion_rate := l_db_sixv_rec.conversion_rate;
2786 END IF;
2787 IF (x_sixv_rec.attribute_category = OKC_API.G_MISS_CHAR)
2788 THEN
2789 x_sixv_rec.attribute_category := l_db_sixv_rec.attribute_category;
2790 END IF;
2791 IF (x_sixv_rec.attribute1 = OKC_API.G_MISS_CHAR)
2792 THEN
2793 x_sixv_rec.attribute1 := l_db_sixv_rec.attribute1;
2794 END IF;
2795 IF (x_sixv_rec.attribute2 = OKC_API.G_MISS_CHAR)
2796 THEN
2797 x_sixv_rec.attribute2 := l_db_sixv_rec.attribute2;
2798 END IF;
2799 IF (x_sixv_rec.attribute3 = OKC_API.G_MISS_CHAR)
2800 THEN
2801 x_sixv_rec.attribute3 := l_db_sixv_rec.attribute3;
2802 END IF;
2803 IF (x_sixv_rec.attribute4 = OKC_API.G_MISS_CHAR)
2804 THEN
2805 x_sixv_rec.attribute4 := l_db_sixv_rec.attribute4;
2806 END IF;
2807 IF (x_sixv_rec.attribute5 = OKC_API.G_MISS_CHAR)
2808 THEN
2809 x_sixv_rec.attribute5 := l_db_sixv_rec.attribute5;
2810 END IF;
2811 IF (x_sixv_rec.attribute6 = OKC_API.G_MISS_CHAR)
2812 THEN
2813 x_sixv_rec.attribute6 := l_db_sixv_rec.attribute6;
2814 END IF;
2815 IF (x_sixv_rec.attribute7 = OKC_API.G_MISS_CHAR)
2816 THEN
2817 x_sixv_rec.attribute7 := l_db_sixv_rec.attribute7;
2818 END IF;
2819 IF (x_sixv_rec.attribute8 = OKC_API.G_MISS_CHAR)
2820 THEN
2821 x_sixv_rec.attribute8 := l_db_sixv_rec.attribute8;
2822 END IF;
2823 IF (x_sixv_rec.attribute9 = OKC_API.G_MISS_CHAR)
2824 THEN
2825 x_sixv_rec.attribute9 := l_db_sixv_rec.attribute9;
2826 END IF;
2827 IF (x_sixv_rec.attribute10 = OKC_API.G_MISS_CHAR)
2828 THEN
2829 x_sixv_rec.attribute10 := l_db_sixv_rec.attribute10;
2830 END IF;
2831 IF (x_sixv_rec.attribute11 = OKC_API.G_MISS_CHAR)
2832 THEN
2833 x_sixv_rec.attribute11 := l_db_sixv_rec.attribute11;
2834 END IF;
2835 IF (x_sixv_rec.attribute12 = OKC_API.G_MISS_CHAR)
2836 THEN
2837 x_sixv_rec.attribute12 := l_db_sixv_rec.attribute12;
2838 END IF;
2839 IF (x_sixv_rec.attribute13 = OKC_API.G_MISS_CHAR)
2840 THEN
2841 x_sixv_rec.attribute13 := l_db_sixv_rec.attribute13;
2842 END IF;
2843 IF (x_sixv_rec.attribute14 = OKC_API.G_MISS_CHAR)
2844 THEN
2845 x_sixv_rec.attribute14 := l_db_sixv_rec.attribute14;
2846 END IF;
2847 IF (x_sixv_rec.attribute15 = OKC_API.G_MISS_CHAR)
2848 THEN
2849 x_sixv_rec.attribute15 := l_db_sixv_rec.attribute15;
2850 END IF;
2851 IF (x_sixv_rec.created_by = OKC_API.G_MISS_NUM)
2852 THEN
2853 x_sixv_rec.created_by := l_db_sixv_rec.created_by;
2854 END IF;
2855 IF (x_sixv_rec.creation_date = OKC_API.G_MISS_DATE)
2856 THEN
2857 x_sixv_rec.creation_date := l_db_sixv_rec.creation_date;
2858 END IF;
2859 IF (x_sixv_rec.last_updated_by = OKC_API.G_MISS_NUM)
2860 THEN
2861 x_sixv_rec.last_updated_by := l_db_sixv_rec.last_updated_by;
2862 END IF;
2863 IF (x_sixv_rec.last_update_date = OKC_API.G_MISS_DATE)
2864 THEN
2865 x_sixv_rec.last_update_date := l_db_sixv_rec.last_update_date;
2866 END IF;
2867 IF (x_sixv_rec.last_update_login = OKC_API.G_MISS_NUM)
2868 THEN
2869 x_sixv_rec.last_update_login := l_db_sixv_rec.last_update_login;
2870 END IF;
2871 END IF;
2872 RETURN(l_return_status);
2873 END populate_new_record;
2874 ------------------------------------------------
2875 -- Set_Attributes for:OKL_TRX_SUBSIDY_POOLS_V --
2876 ------------------------------------------------
2877 FUNCTION Set_Attributes (
2878 p_sixv_rec IN sixv_rec_type,
2879 x_sixv_rec OUT NOCOPY sixv_rec_type
2880 ) RETURN VARCHAR2 IS
2881 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2882 BEGIN
2883 x_sixv_rec := p_sixv_rec;
2884 RETURN(l_return_status);
2885 END Set_Attributes;
2886 BEGIN
2887 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2888 G_PKG_NAME,
2889 p_init_msg_list,
2890 l_api_version,
2891 p_api_version,
2892 '_PVT',
2893 x_return_status);
2894 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2895 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2896 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2897 RAISE OKC_API.G_EXCEPTION_ERROR;
2898 END IF;
2899 --- Setting item attributes
2900 l_return_status := Set_Attributes(
2901 p_sixv_rec, -- IN
2902 x_sixv_rec); -- OUT
2903 --- If any errors happen abort API
2904 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2905 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2906 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2907 RAISE OKC_API.G_EXCEPTION_ERROR;
2908 END IF;
2909 l_return_status := populate_new_record(l_sixv_rec, l_def_sixv_rec);
2910 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2911 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2912 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2913 RAISE OKC_API.G_EXCEPTION_ERROR;
2914 END IF;
2915 l_def_sixv_rec := fill_who_columns(l_def_sixv_rec);
2916 --- Validate all non-missing attributes (Item Level Validation)
2917 l_return_status := Validate_Attributes(l_def_sixv_rec);
2918 --- If any errors happen abort API
2919 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2920 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2921 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2922 RAISE OKC_API.G_EXCEPTION_ERROR;
2923 END IF;
2924 l_return_status := Validate_Record(l_def_sixv_rec, l_db_sixv_rec);
2925 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2926 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2927 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2928 RAISE OKC_API.G_EXCEPTION_ERROR;
2929 END IF;
2930 /*****************commented*********
2931 --avsingh
2932 -- Lock the Record
2933 lock_row(
2934 p_api_version => p_api_version,
2935 p_init_msg_list => p_init_msg_list,
2936 x_return_status => l_return_status,
2937 x_msg_count => x_msg_count,
2938 x_msg_data => x_msg_data,
2939 p_sixv_rec => p_sixv_rec);
2940 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2941 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2942 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2943 RAISE OKC_API.G_EXCEPTION_ERROR;
2944 END IF;
2945 ****************************************/
2946
2947 -----------------------------------------
2948 -- Move VIEW record to "Child" records --
2949 -----------------------------------------
2950 migrate(l_def_sixv_rec, l_okl_trx_subsidy_pools_rec);
2951 -----------------------------------------------
2952 -- Call the UPDATE_ROW for each child record --
2953 -----------------------------------------------
2954 update_row(
2955 p_init_msg_list,
2956 l_return_status,
2957 x_msg_count,
2958 x_msg_data,
2959 l_okl_trx_subsidy_pools_rec,
2960 lx_okl_trx_subsidy_pools_rec
2961 );
2962 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2963 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2964 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2965 RAISE OKC_API.G_EXCEPTION_ERROR;
2966 END IF;
2967 migrate(lx_okl_trx_subsidy_pools_rec, l_def_sixv_rec);
2968 x_sixv_rec := l_def_sixv_rec;
2969 x_return_status := l_return_status;
2970 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2971 EXCEPTION
2972 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2973 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2974 (
2975 l_api_name,
2976 G_PKG_NAME,
2977 'OKC_API.G_RET_STS_ERROR',
2978 x_msg_count,
2979 x_msg_data,
2980 '_PVT'
2981 );
2982 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2983 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2984 (
2985 l_api_name,
2986 G_PKG_NAME,
2987 'OKC_API.G_RET_STS_UNEXP_ERROR',
2988 x_msg_count,
2989 x_msg_data,
2990 '_PVT'
2991 );
2992 WHEN OTHERS THEN
2993 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2994 (
2995 l_api_name,
2996 G_PKG_NAME,
2997 'OTHERS',
2998 x_msg_count,
2999 x_msg_data,
3000 '_PVT'
3001 );
3002 END update_row;
3003 ----------------------------------------
3004 -- PL/SQL TBL update_row for:sixv_tbl --
3005 ----------------------------------------
3006 PROCEDURE update_row(
3007 p_api_version IN NUMBER,
3008 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3009 x_return_status OUT NOCOPY VARCHAR2,
3010 x_msg_count OUT NOCOPY NUMBER,
3011 x_msg_data OUT NOCOPY VARCHAR2,
3012 p_sixv_tbl IN sixv_tbl_type,
3013 x_sixv_tbl OUT NOCOPY sixv_tbl_type,
3014 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
3015
3016 l_api_version CONSTANT NUMBER := 1;
3017 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_update_row';
3018 i NUMBER := 0;
3019 BEGIN
3020 OKC_API.init_msg_list(p_init_msg_list);
3021 -- Make sure PL/SQL table has records in it before passing
3022 IF (p_sixv_tbl.COUNT > 0) THEN
3023 i := p_sixv_tbl.FIRST;
3024 LOOP
3025 DECLARE
3026 l_error_rec OKC_API.ERROR_REC_TYPE;
3027 BEGIN
3028 l_error_rec.api_name := l_api_name;
3029 l_error_rec.api_package := G_PKG_NAME;
3030 l_error_rec.idx := i;
3031 update_row (
3032 p_api_version => p_api_version,
3033 p_init_msg_list => OKC_API.G_FALSE,
3034 x_return_status => l_error_rec.error_type,
3035 x_msg_count => l_error_rec.msg_count,
3036 x_msg_data => l_error_rec.msg_data,
3037 p_sixv_rec => p_sixv_tbl(i),
3038 x_sixv_rec => x_sixv_tbl(i));
3039 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
3040 l_error_rec.sqlcode := SQLCODE;
3041 load_error_tbl(l_error_rec, px_error_tbl);
3042 ELSE
3043 x_msg_count := l_error_rec.msg_count;
3044 x_msg_data := l_error_rec.msg_data;
3045 END IF;
3046 EXCEPTION
3047 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3048 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3049 l_error_rec.sqlcode := SQLCODE;
3050 load_error_tbl(l_error_rec, px_error_tbl);
3051 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3052 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3053 l_error_rec.sqlcode := SQLCODE;
3054 load_error_tbl(l_error_rec, px_error_tbl);
3055 WHEN OTHERS THEN
3056 l_error_rec.error_type := 'OTHERS';
3057 l_error_rec.sqlcode := SQLCODE;
3058 load_error_tbl(l_error_rec, px_error_tbl);
3059 END;
3060 EXIT WHEN (i = p_sixv_tbl.LAST);
3061 i := p_sixv_tbl.NEXT(i);
3062 END LOOP;
3063 END IF;
3064 -- Loop through the error_tbl to find the error with the highest severity
3065 -- and return it.
3066 x_return_status := find_highest_exception(px_error_tbl);
3067 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3068 EXCEPTION
3069 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3070 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3071 (
3072 l_api_name,
3073 G_PKG_NAME,
3074 'OKC_API.G_RET_STS_ERROR',
3075 x_msg_count,
3076 x_msg_data,
3077 '_PVT'
3078 );
3079 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3080 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3081 (
3082 l_api_name,
3083 G_PKG_NAME,
3084 'OKC_API.G_RET_STS_UNEXP_ERROR',
3085 x_msg_count,
3086 x_msg_data,
3087 '_PVT'
3088 );
3089 WHEN OTHERS THEN
3090 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3091 (
3092 l_api_name,
3093 G_PKG_NAME,
3094 'OTHERS',
3095 x_msg_count,
3096 x_msg_data,
3097 '_PVT'
3098 );
3099 END update_row;
3100
3101 ----------------------------------------
3102 -- PL/SQL TBL update_row for:SIXV_TBL --
3103 ----------------------------------------
3104 PROCEDURE update_row(
3105 p_api_version IN NUMBER,
3106 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3107 x_return_status OUT NOCOPY VARCHAR2,
3108 x_msg_count OUT NOCOPY NUMBER,
3109 x_msg_data OUT NOCOPY VARCHAR2,
3110 p_sixv_tbl IN sixv_tbl_type,
3111 x_sixv_tbl OUT NOCOPY sixv_tbl_type) IS
3112
3113 l_api_version CONSTANT NUMBER := 1;
3114 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3115 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3116 l_error_tbl OKC_API.ERROR_TBL_TYPE;
3117 BEGIN
3118 OKC_API.init_msg_list(p_init_msg_list);
3119 -- Make sure PL/SQL table has records in it before passing
3120 IF (p_sixv_tbl.COUNT > 0) THEN
3121 update_row (
3122 p_api_version => p_api_version,
3123 p_init_msg_list => OKC_API.G_FALSE,
3124 x_return_status => x_return_status,
3125 x_msg_count => x_msg_count,
3126 x_msg_data => x_msg_data,
3127 p_sixv_tbl => p_sixv_tbl,
3128 x_sixv_tbl => x_sixv_tbl,
3129 px_error_tbl => l_error_tbl);
3130 END IF;
3131 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3132 EXCEPTION
3133 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3134 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3135 (
3136 l_api_name,
3137 G_PKG_NAME,
3138 'OKC_API.G_RET_STS_ERROR',
3139 x_msg_count,
3140 x_msg_data,
3141 '_PVT'
3142 );
3143 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3144 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3145 (
3146 l_api_name,
3147 G_PKG_NAME,
3148 'OKC_API.G_RET_STS_UNEXP_ERROR',
3149 x_msg_count,
3150 x_msg_data,
3151 '_PVT'
3152 );
3153 WHEN OTHERS THEN
3154 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3155 (
3156 l_api_name,
3157 G_PKG_NAME,
3158 'OTHERS',
3159 x_msg_count,
3160 x_msg_data,
3161 '_PVT'
3162 );
3163 END update_row;
3164
3165 ---------------------------------------------------------------------------
3166 -- PROCEDURE delete_row
3167 ---------------------------------------------------------------------------
3168 ------------------------------------------
3169 -- delete_row for:OKL_TRX_SUBSIDY_POOLS --
3170 ------------------------------------------
3171 PROCEDURE delete_row(
3172 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3173 x_return_status OUT NOCOPY VARCHAR2,
3174 x_msg_count OUT NOCOPY NUMBER,
3175 x_msg_data OUT NOCOPY VARCHAR2,
3176 p_okl_trx_subsidy_pools_rec IN okl_trx_subsidy_pools_rec_type) IS
3177
3178 l_api_version CONSTANT NUMBER := 1;
3179 l_api_name CONSTANT VARCHAR2(30) := 'B_delete_row';
3180 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3181 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type := p_okl_trx_subsidy_pools_rec;
3182 l_row_notfound BOOLEAN := TRUE;
3183 BEGIN
3184 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3185 p_init_msg_list,
3186 '_PVT',
3187 x_return_status);
3188 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3189 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3190 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3191 RAISE OKC_API.G_EXCEPTION_ERROR;
3192 END IF;
3193
3194 DELETE FROM OKL_TRX_SUBSIDY_POOLS
3195 WHERE ID = p_okl_trx_subsidy_pools_rec.id;
3196
3197 x_return_status := l_return_status;
3198 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3199 EXCEPTION
3200 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3201 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3202 (
3203 l_api_name,
3204 G_PKG_NAME,
3205 'OKC_API.G_RET_STS_ERROR',
3206 x_msg_count,
3207 x_msg_data,
3208 '_PVT'
3209 );
3210 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3211 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3212 (
3213 l_api_name,
3214 G_PKG_NAME,
3215 'OKC_API.G_RET_STS_UNEXP_ERROR',
3216 x_msg_count,
3217 x_msg_data,
3218 '_PVT'
3219 );
3220 WHEN OTHERS THEN
3221 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3222 (
3223 l_api_name,
3224 G_PKG_NAME,
3225 'OTHERS',
3226 x_msg_count,
3227 x_msg_data,
3228 '_PVT'
3229 );
3230 END delete_row;
3231 --------------------------------------------
3232 -- delete_row for:OKL_TRX_SUBSIDY_POOLS_V --
3233 --------------------------------------------
3234 PROCEDURE delete_row(
3235 p_api_version IN NUMBER,
3236 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3237 x_return_status OUT NOCOPY VARCHAR2,
3238 x_msg_count OUT NOCOPY NUMBER,
3239 x_msg_data OUT NOCOPY VARCHAR2,
3240 p_sixv_rec IN sixv_rec_type) IS
3241
3242 l_api_version CONSTANT NUMBER := 1;
3243 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
3244 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3245 l_sixv_rec sixv_rec_type := p_sixv_rec;
3246 l_okl_trx_subsidy_pools_rec okl_trx_subsidy_pools_rec_type;
3247 BEGIN
3248 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3249 G_PKG_NAME,
3250 p_init_msg_list,
3251 l_api_version,
3252 p_api_version,
3253 '_PVT',
3254 x_return_status);
3255 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3256 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3257 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3258 RAISE OKC_API.G_EXCEPTION_ERROR;
3259 END IF;
3260 -----------------------------------------
3261 -- Move VIEW record to "Child" records --
3262 -----------------------------------------
3263 migrate(l_sixv_rec, l_okl_trx_subsidy_pools_rec);
3264 -----------------------------------------------
3265 -- Call the DELETE_ROW for each child record --
3266 -----------------------------------------------
3267 delete_row(
3268 p_init_msg_list,
3269 l_return_status,
3270 x_msg_count,
3271 x_msg_data,
3272 l_okl_trx_subsidy_pools_rec
3273 );
3274 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3275 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3276 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3277 RAISE OKC_API.G_EXCEPTION_ERROR;
3278 END IF;
3279 x_return_status := l_return_status;
3280 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3281 EXCEPTION
3282 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3283 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3284 (
3285 l_api_name,
3286 G_PKG_NAME,
3287 'OKC_API.G_RET_STS_ERROR',
3288 x_msg_count,
3289 x_msg_data,
3290 '_PVT'
3291 );
3292 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3293 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3294 (
3295 l_api_name,
3296 G_PKG_NAME,
3297 'OKC_API.G_RET_STS_UNEXP_ERROR',
3298 x_msg_count,
3299 x_msg_data,
3300 '_PVT'
3301 );
3302 WHEN OTHERS THEN
3303 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3304 (
3305 l_api_name,
3306 G_PKG_NAME,
3307 'OTHERS',
3308 x_msg_count,
3309 x_msg_data,
3310 '_PVT'
3311 );
3312 END delete_row;
3313 -------------------------------------------------------
3314 -- PL/SQL TBL delete_row for:OKL_TRX_SUBSIDY_POOLS_V --
3315 -------------------------------------------------------
3316 PROCEDURE delete_row(
3317 p_api_version IN NUMBER,
3318 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3319 x_return_status OUT NOCOPY VARCHAR2,
3320 x_msg_count OUT NOCOPY NUMBER,
3321 x_msg_data OUT NOCOPY VARCHAR2,
3322 p_sixv_tbl IN sixv_tbl_type,
3323 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
3324
3325 l_api_version CONSTANT NUMBER := 1;
3326 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_delete_row';
3327 i NUMBER := 0;
3328 BEGIN
3329 OKC_API.init_msg_list(p_init_msg_list);
3330 -- Make sure PL/SQL table has records in it before passing
3331 IF (p_sixv_tbl.COUNT > 0) THEN
3332 i := p_sixv_tbl.FIRST;
3333 LOOP
3334 DECLARE
3335 l_error_rec OKC_API.ERROR_REC_TYPE;
3336 BEGIN
3337 l_error_rec.api_name := l_api_name;
3338 l_error_rec.api_package := G_PKG_NAME;
3339 l_error_rec.idx := i;
3340 delete_row (
3341 p_api_version => p_api_version,
3342 p_init_msg_list => OKC_API.G_FALSE,
3343 x_return_status => l_error_rec.error_type,
3344 x_msg_count => l_error_rec.msg_count,
3345 x_msg_data => l_error_rec.msg_data,
3346 p_sixv_rec => p_sixv_tbl(i));
3347 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
3348 l_error_rec.sqlcode := SQLCODE;
3349 load_error_tbl(l_error_rec, px_error_tbl);
3350 ELSE
3351 x_msg_count := l_error_rec.msg_count;
3352 x_msg_data := l_error_rec.msg_data;
3353 END IF;
3354 EXCEPTION
3355 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3356 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3357 l_error_rec.sqlcode := SQLCODE;
3358 load_error_tbl(l_error_rec, px_error_tbl);
3359 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3360 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3361 l_error_rec.sqlcode := SQLCODE;
3362 load_error_tbl(l_error_rec, px_error_tbl);
3363 WHEN OTHERS THEN
3364 l_error_rec.error_type := 'OTHERS';
3365 l_error_rec.sqlcode := SQLCODE;
3366 load_error_tbl(l_error_rec, px_error_tbl);
3367 END;
3368 EXIT WHEN (i = p_sixv_tbl.LAST);
3369 i := p_sixv_tbl.NEXT(i);
3370 END LOOP;
3371 END IF;
3372 -- Loop through the error_tbl to find the error with the highest severity
3373 -- and return it.
3374 x_return_status := find_highest_exception(px_error_tbl);
3375 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3376 EXCEPTION
3377 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3378 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3379 (
3380 l_api_name,
3381 G_PKG_NAME,
3382 'OKC_API.G_RET_STS_ERROR',
3383 x_msg_count,
3384 x_msg_data,
3385 '_PVT'
3386 );
3387 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3388 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3389 (
3390 l_api_name,
3391 G_PKG_NAME,
3392 'OKC_API.G_RET_STS_UNEXP_ERROR',
3393 x_msg_count,
3394 x_msg_data,
3395 '_PVT'
3396 );
3397 WHEN OTHERS THEN
3398 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3399 (
3400 l_api_name,
3401 G_PKG_NAME,
3402 'OTHERS',
3403 x_msg_count,
3404 x_msg_data,
3405 '_PVT'
3406 );
3407 END delete_row;
3408
3409 -------------------------------------------------------
3410 -- PL/SQL TBL delete_row for:OKL_TRX_SUBSIDY_POOLS_V --
3411 -------------------------------------------------------
3412 PROCEDURE delete_row(
3413 p_api_version IN NUMBER,
3414 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3415 x_return_status OUT NOCOPY VARCHAR2,
3416 x_msg_count OUT NOCOPY NUMBER,
3417 x_msg_data OUT NOCOPY VARCHAR2,
3418 p_sixv_tbl IN sixv_tbl_type) IS
3419
3420 l_api_version CONSTANT NUMBER := 1;
3421 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3422 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3423 l_error_tbl OKC_API.ERROR_TBL_TYPE;
3424 BEGIN
3425 OKC_API.init_msg_list(p_init_msg_list);
3426 -- Make sure PL/SQL table has records in it before passing
3427 IF (p_sixv_tbl.COUNT > 0) THEN
3428 delete_row (
3429 p_api_version => p_api_version,
3430 p_init_msg_list => OKC_API.G_FALSE,
3431 x_return_status => x_return_status,
3432 x_msg_count => x_msg_count,
3433 x_msg_data => x_msg_data,
3434 p_sixv_tbl => p_sixv_tbl,
3435 px_error_tbl => l_error_tbl);
3436 END IF;
3437 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3438 EXCEPTION
3439 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3440 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3441 (
3442 l_api_name,
3443 G_PKG_NAME,
3444 'OKC_API.G_RET_STS_ERROR',
3445 x_msg_count,
3446 x_msg_data,
3447 '_PVT'
3448 );
3449 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3450 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3451 (
3452 l_api_name,
3453 G_PKG_NAME,
3454 'OKC_API.G_RET_STS_UNEXP_ERROR',
3455 x_msg_count,
3456 x_msg_data,
3457 '_PVT'
3458 );
3459 WHEN OTHERS THEN
3460 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3461 (
3462 l_api_name,
3463 G_PKG_NAME,
3464 'OTHERS',
3465 x_msg_count,
3466 x_msg_data,
3467 '_PVT'
3468 );
3469 END delete_row;
3470
3471 END OKL_SIX_PVT;