DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKS_BCL_PVT

Source


1 PACKAGE BODY OKS_BCL_PVT AS
2 /* $Header: OKSSBCLB.pls 120.0 2005/05/25 18:11:38 appldev noship $ */
3   ---------------------------------------------------------------------------
4   -- FUNCTION get_seq_id
5   ---------------------------------------------------------------------------
6   FUNCTION get_seq_id RETURN NUMBER IS
7   BEGIN
8     RETURN(okc_p_util.raw_to_number(sys_guid()));
9   END get_seq_id;
10 
11   ---------------------------------------------------------------------------
12   -- PROCEDURE qc
13   ---------------------------------------------------------------------------
14   PROCEDURE qc IS
15   BEGIN
16     null;
17   END qc;
18 
19   ---------------------------------------------------------------------------
20   -- PROCEDURE change_version
21   ---------------------------------------------------------------------------
22   PROCEDURE change_version IS
23   BEGIN
24     null;
25   END change_version;
26 
27   ---------------------------------------------------------------------------
28   -- PROCEDURE api_copy
29   ---------------------------------------------------------------------------
30   PROCEDURE api_copy IS
31   BEGIN
32     null;
33   END api_copy;
34 
35   ---------------------------------------------------------------------------
36   -- FUNCTION get_rec for: OKS_BILL_CONT_LINES
37   ---------------------------------------------------------------------------
38   FUNCTION get_rec (
39     p_bcl_rec                      IN bcl_rec_type,
40     x_no_data_found                OUT NOCOPY BOOLEAN
41   ) RETURN bcl_rec_type IS
42     CURSOR bcl_pk_csr (p_id                 IN NUMBER) IS
43     SELECT
44             ID,
45             CLE_ID,
46             BTN_ID,
47             DATE_BILLED_FROM,
48             DATE_BILLED_TO,
49             SENT_YN,
50             CURRENCY_CODE,
51             OBJECT_VERSION_NUMBER,
52             CREATED_BY,
53             CREATION_DATE,
54             LAST_UPDATED_BY,
55             LAST_UPDATE_DATE,
56             AMOUNT,
57             BILL_ACTION,
58             DATE_NEXT_INVOICE,
59             LAST_UPDATE_LOGIN,
60             ATTRIBUTE_CATEGORY,
61             ATTRIBUTE1,
62             ATTRIBUTE2,
63             ATTRIBUTE3,
64             ATTRIBUTE4,
65             ATTRIBUTE5,
66             ATTRIBUTE6,
67             ATTRIBUTE7,
68             ATTRIBUTE8,
69             ATTRIBUTE9,
70             ATTRIBUTE10,
71             ATTRIBUTE11,
72             ATTRIBUTE12,
73             ATTRIBUTE13,
74             ATTRIBUTE14,
75             ATTRIBUTE15
76       FROM Oks_Bill_Cont_Lines
77      WHERE oks_bill_cont_lines.id = p_id;
78     l_bcl_pk                       bcl_pk_csr%ROWTYPE;
79     l_bcl_rec                      bcl_rec_type;
80   BEGIN
81     x_no_data_found := TRUE;
82     -- Get current database values
83     OPEN bcl_pk_csr (p_bcl_rec.id);
84     FETCH bcl_pk_csr INTO
85               l_bcl_rec.ID,
86               l_bcl_rec.CLE_ID,
87               l_bcl_rec.BTN_ID,
88               l_bcl_rec.DATE_BILLED_FROM,
89               l_bcl_rec.DATE_BILLED_TO,
90               l_bcl_rec.SENT_YN,
91               l_bcl_rec.CURRENCY_CODE,
92               l_bcl_rec.OBJECT_VERSION_NUMBER,
93               l_bcl_rec.CREATED_BY,
94               l_bcl_rec.CREATION_DATE,
95               l_bcl_rec.LAST_UPDATED_BY,
96               l_bcl_rec.LAST_UPDATE_DATE,
97               l_bcl_rec.AMOUNT,
98               l_bcl_rec.BILL_ACTION,
99               l_bcl_rec.DATE_NEXT_INVOICE,
100               l_bcl_rec.LAST_UPDATE_LOGIN,
101               l_bcl_rec.ATTRIBUTE_CATEGORY,
102               l_bcl_rec.ATTRIBUTE1,
103               l_bcl_rec.ATTRIBUTE2,
104               l_bcl_rec.ATTRIBUTE3,
105               l_bcl_rec.ATTRIBUTE4,
106               l_bcl_rec.ATTRIBUTE5,
107               l_bcl_rec.ATTRIBUTE6,
108               l_bcl_rec.ATTRIBUTE7,
109               l_bcl_rec.ATTRIBUTE8,
110               l_bcl_rec.ATTRIBUTE9,
111               l_bcl_rec.ATTRIBUTE10,
112               l_bcl_rec.ATTRIBUTE11,
113               l_bcl_rec.ATTRIBUTE12,
114               l_bcl_rec.ATTRIBUTE13,
115               l_bcl_rec.ATTRIBUTE14,
116               l_bcl_rec.ATTRIBUTE15;
117     x_no_data_found := bcl_pk_csr%NOTFOUND;
118     CLOSE bcl_pk_csr;
119     RETURN(l_bcl_rec);
120   END get_rec;
121 
122   FUNCTION get_rec (
123     p_bcl_rec                      IN bcl_rec_type
124   ) RETURN bcl_rec_type IS
125     l_row_notfound                 BOOLEAN := TRUE;
126   BEGIN
127     RETURN(get_rec(p_bcl_rec, l_row_notfound));
128   END get_rec;
129   ---------------------------------------------------------------------------
130   -- FUNCTION get_rec for: OKS_BILL_CONT_LINES_V
131   ---------------------------------------------------------------------------
132   FUNCTION get_rec (
133     p_bclv_rec                     IN bclv_rec_type,
134     x_no_data_found                OUT NOCOPY BOOLEAN
135   ) RETURN bclv_rec_type IS
136     CURSOR okc_bclv_pk_csr (p_id                 IN NUMBER) IS
137     SELECT
138             ID,
139             OBJECT_VERSION_NUMBER,
140             CLE_ID,
141             BTN_ID,
142             DATE_BILLED_FROM,
143             DATE_BILLED_TO,
144             DATE_NEXT_INVOICE,
145             AMOUNT,
146             SENT_YN,
147             CURRENCY_CODE,
148             BILL_ACTION,
149             ATTRIBUTE_CATEGORY,
150             ATTRIBUTE1,
151             ATTRIBUTE2,
152             ATTRIBUTE3,
153             ATTRIBUTE4,
154             ATTRIBUTE5,
155             ATTRIBUTE6,
156             ATTRIBUTE7,
157             ATTRIBUTE8,
158             ATTRIBUTE9,
159             ATTRIBUTE10,
160             ATTRIBUTE11,
161             ATTRIBUTE12,
162             ATTRIBUTE13,
163             ATTRIBUTE14,
164             ATTRIBUTE15,
165             CREATED_BY,
166             CREATION_DATE,
167             LAST_UPDATED_BY,
168             LAST_UPDATE_DATE,
169             LAST_UPDATE_LOGIN
170       FROM Oks_Bill_Cont_Lines_V
171      WHERE oks_bill_cont_lines_v.id = p_id;
172     l_okc_bclv_pk                  okc_bclv_pk_csr%ROWTYPE;
173     l_bclv_rec                     bclv_rec_type;
174   BEGIN
175     x_no_data_found := TRUE;
176     -- Get current database values
177     OPEN okc_bclv_pk_csr (p_bclv_rec.id);
178     FETCH okc_bclv_pk_csr INTO
179               l_bclv_rec.ID,
180               l_bclv_rec.OBJECT_VERSION_NUMBER,
181               l_bclv_rec.CLE_ID,
182               l_bclv_rec.BTN_ID,
183               l_bclv_rec.DATE_BILLED_FROM,
184               l_bclv_rec.DATE_BILLED_TO,
185               l_bclv_rec.DATE_NEXT_INVOICE,
186               l_bclv_rec.AMOUNT,
187               l_bclv_rec.SENT_YN,
188               l_bclv_rec.CURRENCY_CODE,
189               l_bclv_rec.BILL_ACTION,
190               l_bclv_rec.ATTRIBUTE_CATEGORY,
191               l_bclv_rec.ATTRIBUTE1,
192               l_bclv_rec.ATTRIBUTE2,
193               l_bclv_rec.ATTRIBUTE3,
194               l_bclv_rec.ATTRIBUTE4,
195               l_bclv_rec.ATTRIBUTE5,
196               l_bclv_rec.ATTRIBUTE6,
197               l_bclv_rec.ATTRIBUTE7,
198               l_bclv_rec.ATTRIBUTE8,
199               l_bclv_rec.ATTRIBUTE9,
200               l_bclv_rec.ATTRIBUTE10,
201               l_bclv_rec.ATTRIBUTE11,
202               l_bclv_rec.ATTRIBUTE12,
203               l_bclv_rec.ATTRIBUTE13,
204               l_bclv_rec.ATTRIBUTE14,
205               l_bclv_rec.ATTRIBUTE15,
206               l_bclv_rec.CREATED_BY,
207               l_bclv_rec.CREATION_DATE,
208               l_bclv_rec.LAST_UPDATED_BY,
209               l_bclv_rec.LAST_UPDATE_DATE,
210               l_bclv_rec.LAST_UPDATE_LOGIN;
211     x_no_data_found := okc_bclv_pk_csr%NOTFOUND;
212     CLOSE okc_bclv_pk_csr;
213     RETURN(l_bclv_rec);
214   END get_rec;
215 
216   FUNCTION get_rec (
217     p_bclv_rec                     IN bclv_rec_type
218   ) RETURN bclv_rec_type IS
219     l_row_notfound                 BOOLEAN := TRUE;
220   BEGIN
221     RETURN(get_rec(p_bclv_rec, l_row_notfound));
222   END get_rec;
223 
224   -----------------------------------------------------------
225   -- FUNCTION null_out_defaults for: OKS_BILL_CONT_LINES_V --
226   -----------------------------------------------------------
227   FUNCTION null_out_defaults (
228     p_bclv_rec	IN bclv_rec_type
229   ) RETURN bclv_rec_type IS
230     l_bclv_rec	bclv_rec_type := p_bclv_rec;
231   BEGIN
232     IF (l_bclv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
233       l_bclv_rec.object_version_number := NULL;
234     END IF;
235     IF (l_bclv_rec.cle_id = OKC_API.G_MISS_NUM) THEN
236       l_bclv_rec.cle_id := NULL;
237     END IF;
238     IF (l_bclv_rec.btn_id = OKC_API.G_MISS_NUM) THEN
239       l_bclv_rec.btn_id := NULL;
240     END IF;
241     IF (l_bclv_rec.date_billed_from = OKC_API.G_MISS_DATE) THEN
242       l_bclv_rec.date_billed_from := NULL;
243     END IF;
244     IF (l_bclv_rec.date_billed_to = OKC_API.G_MISS_DATE) THEN
245       l_bclv_rec.date_billed_to := NULL;
246     END IF;
247     IF (l_bclv_rec.date_next_invoice = OKC_API.G_MISS_DATE) THEN
248       l_bclv_rec.date_next_invoice := NULL;
249     END IF;
250     IF (l_bclv_rec.amount = OKC_API.G_MISS_NUM) THEN
251       l_bclv_rec.amount := NULL;
252     END IF;
253     IF (l_bclv_rec.sent_yn = OKC_API.G_MISS_CHAR) THEN
254       l_bclv_rec.sent_yn := NULL;
255     END IF;
256     IF (l_bclv_rec.currency_code = OKC_API.G_MISS_CHAR) THEN
257       l_bclv_rec.currency_code := NULL;
258     END IF;
259     IF (l_bclv_rec.bill_action = OKC_API.G_MISS_CHAR) THEN
260       l_bclv_rec.bill_action := NULL;
261     END IF;
262     IF (l_bclv_rec.attribute_category = OKC_API.G_MISS_CHAR) THEN
263       l_bclv_rec.attribute_category := NULL;
264     END IF;
265     IF (l_bclv_rec.attribute1 = OKC_API.G_MISS_CHAR) THEN
266       l_bclv_rec.attribute1 := NULL;
267     END IF;
268     IF (l_bclv_rec.attribute2 = OKC_API.G_MISS_CHAR) THEN
269       l_bclv_rec.attribute2 := NULL;
270     END IF;
271     IF (l_bclv_rec.attribute3 = OKC_API.G_MISS_CHAR) THEN
272       l_bclv_rec.attribute3 := NULL;
273     END IF;
274     IF (l_bclv_rec.attribute4 = OKC_API.G_MISS_CHAR) THEN
275       l_bclv_rec.attribute4 := NULL;
276     END IF;
277     IF (l_bclv_rec.attribute5 = OKC_API.G_MISS_CHAR) THEN
278       l_bclv_rec.attribute5 := NULL;
279     END IF;
280     IF (l_bclv_rec.attribute6 = OKC_API.G_MISS_CHAR) THEN
281       l_bclv_rec.attribute6 := NULL;
282     END IF;
283     IF (l_bclv_rec.attribute7 = OKC_API.G_MISS_CHAR) THEN
284       l_bclv_rec.attribute7 := NULL;
285     END IF;
286     IF (l_bclv_rec.attribute8 = OKC_API.G_MISS_CHAR) THEN
287       l_bclv_rec.attribute8 := NULL;
288     END IF;
289     IF (l_bclv_rec.attribute9 = OKC_API.G_MISS_CHAR) THEN
290       l_bclv_rec.attribute9 := NULL;
291     END IF;
292     IF (l_bclv_rec.attribute10 = OKC_API.G_MISS_CHAR) THEN
293       l_bclv_rec.attribute10 := NULL;
294     END IF;
295     IF (l_bclv_rec.attribute11 = OKC_API.G_MISS_CHAR) THEN
296       l_bclv_rec.attribute11 := NULL;
297     END IF;
298     IF (l_bclv_rec.attribute12 = OKC_API.G_MISS_CHAR) THEN
299       l_bclv_rec.attribute12 := NULL;
300     END IF;
301     IF (l_bclv_rec.attribute13 = OKC_API.G_MISS_CHAR) THEN
302       l_bclv_rec.attribute13 := NULL;
303     END IF;
304     IF (l_bclv_rec.attribute14 = OKC_API.G_MISS_CHAR) THEN
305       l_bclv_rec.attribute14 := NULL;
306     END IF;
307     IF (l_bclv_rec.attribute15 = OKC_API.G_MISS_CHAR) THEN
308       l_bclv_rec.attribute15 := NULL;
309     END IF;
310     IF (l_bclv_rec.created_by = OKC_API.G_MISS_NUM) THEN
311       l_bclv_rec.created_by := NULL;
312     END IF;
313     IF (l_bclv_rec.creation_date = OKC_API.G_MISS_DATE) THEN
314       l_bclv_rec.creation_date := NULL;
315     END IF;
316     IF (l_bclv_rec.last_updated_by = OKC_API.G_MISS_NUM) THEN
317       l_bclv_rec.last_updated_by := NULL;
318     END IF;
319     IF (l_bclv_rec.last_update_date = OKC_API.G_MISS_DATE) THEN
320       l_bclv_rec.last_update_date := NULL;
321     END IF;
322     IF (l_bclv_rec.last_update_login = OKC_API.G_MISS_NUM) THEN
323       l_bclv_rec.last_update_login := NULL;
324     END IF;
325     RETURN(l_bclv_rec);
326   END null_out_defaults;
327   ---------------------------------------------------------------------------
328   -- PROCEDURE Validate_Attributes
329   ---------------------------------------------------------------------------
330 PROCEDURE validate_id(x_return_status OUT NOCOPY varchar2,
331 				p_id   IN  Number)
332   Is
333   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
334   Begin
335 
336   x_return_status := OKC_API.G_RET_STS_SUCCESS;
337 
338   If p_id = OKC_API.G_MISS_NUM OR
339        p_id IS NULL
340   Then
341       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'id');
342       l_return_status := OKC_API.G_RET_STS_ERROR;
343   End If;
344 
345   Exception
346   When  G_EXCEPTION_HALT_VALIDATION THEN
347             x_return_status := l_return_status;
348 		NULL;
349   When OTHERS THEN
350 	-- store SQL error message on message stack for caller
351 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
352                           p_msg_name     => g_unexpected_error,
353                           p_token1       => g_sqlcode_token,
354                           p_token1_value => sqlcode,
355                           p_token2       => g_sqlerrm_token,
356                           p_token2_value => sqlerrm);
357 
358       -- notify caller of an UNEXPECTED error
359       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
360   End validate_id;
361 
362 
363 PROCEDURE validate_cle_id(x_return_status OUT NOCOPY varchar2,
364 					 P_cle_id IN  Number)
365   Is
366   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
367   l_dummy_var   VARCHAR2(1) := '?';
368   Cursor l_cle_Csr Is
369   	  select 'x'
370 	  from OKC_K_LINES_V
371   	  where id = P_cle_id;
372 
373 Begin
374    If p_cle_id  = OKC_API.G_MISS_NUM OR
375       p_cle_id  IS NULL
376    Then
377       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'cle_id');
378 
379      l_return_status := OKC_API.G_RET_STS_ERROR;
380      RAISE G_EXCEPTION_HALT_VALIDATION;
381    End If;
382 
383    If (p_cle_id <> OKC_API.G_MISS_NUM and
384   	   p_cle_id IS NOT NULL)
385    Then
386        Open l_cle_csr;
387        Fetch l_cle_csr Into l_dummy_var;
388        Close l_cle_csr;
389        -- if l_dummy_var still set to default, data was not found
390        If (l_dummy_var = '?') Then
391   	          OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
392                           p_msg_name     => g_unexpected_error,
393                           p_token1       => g_sqlcode_token,
394                           p_token1_value => sqlcode,
395                           p_token2       => g_sqlerrm_token,
396                           p_token2_value => 'cle_id ');
397 
398 	     -- notify caller of an error
399           x_return_status := OKC_API.G_RET_STS_ERROR;
400        End If;
401    End If;
402   ---------giving prob so commented
403     Exception
404   When  G_EXCEPTION_HALT_VALIDATION Then
405 		NULL;
406   When OTHERS Then
407 	-- store SQL error message on message stack for caller
408 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
409                           p_msg_name     => g_unexpected_error,
410                           p_token1       => g_sqlcode_token,
411                           p_token1_value => sqlcode,
412                           p_token2       => g_sqlerrm_token,
413                           p_token2_value => sqlerrm);
414 
415       -- notify caller of an UNEXPECTED error
416       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
417   END validate_cle_id;
418 
419 
420 PROCEDURE validate_btn_id(x_return_status OUT NOCOPY varchar2,
421 					 P_btn_id IN  Number)
422   Is
423   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
424   Begin
425      x_return_status := OKC_API.G_RET_STS_SUCCESS;
426 
427   ------giving prob so commented
428   Exception
429   When  G_EXCEPTION_HALT_VALIDATION Then
430 		NULL;
431   When OTHERS Then
432 	-- store SQL error message on message stack for caller
433 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
434                           p_msg_name     => g_unexpected_error,
435                           p_token1       => g_sqlcode_token,
436                           p_token1_value => sqlcode,
437                           p_token2       => g_sqlerrm_token,
438                           p_token2_value => sqlerrm);
439 
440       -- notify caller of an UNEXPECTED error
441       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
442   END validate_btn_id;
443 
444 
445 
446 PROCEDURE validate_Date_Billed_from(	x_return_status OUT NOCOPY varchar2,
447 							 P_Date_Billed_from IN  DATE)
448   Is
449   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
450 
451   Begin
452 
453 
454   x_return_status := OKC_API.G_RET_STS_SUCCESS;
455 
456   Exception
457   When  G_EXCEPTION_HALT_VALIDATION Then
458 		NULL;
459   When OTHERS Then
460 	-- store SQL error message on message stack for caller
461 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
462                           p_msg_name     => g_unexpected_error,
463                           p_token1       => g_sqlcode_token,
464                           p_token1_value => sqlcode,
465                           p_token2       => g_sqlerrm_token,
466                           p_token2_value => sqlerrm);
467 
468       -- notify caller of an UNEXPECTED error
469       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
470 
471 
472   END validate_Date_Billed_from;
473 
474 
475 PROCEDURE validate_Date_Billed_to(	x_return_status OUT NOCOPY varchar2,
476 							 P_Date_Billed_to IN  DATE)
477   Is
478   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
479 
480   Begin
481 
482 
483   x_return_status := OKC_API.G_RET_STS_SUCCESS;
484 
485   Exception
486   When  G_EXCEPTION_HALT_VALIDATION Then
487 		NULL;
488   When OTHERS Then
489 	-- store SQL error message on message stack for caller
490 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
491                           p_msg_name     => g_unexpected_error,
492                           p_token1       => g_sqlcode_token,
493                           p_token1_value => sqlcode,
494                           p_token2       => g_sqlerrm_token,
495                           p_token2_value => sqlerrm);
496 
497       -- notify caller of an UNEXPECTED error
498       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
499 
500 
501   END validate_Date_Billed_to;
502 
503 
504 PROCEDURE validate_Date_Next_Invoice(	x_return_status OUT NOCOPY varchar2,
505 							 P_Date_Next_Invoice IN  DATE)
506   Is
507   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
508 
509   Begin
510 
511 
512   x_return_status := OKC_API.G_RET_STS_SUCCESS;
513 
514   Exception
515   When  G_EXCEPTION_HALT_VALIDATION Then
516 		NULL;
517   When OTHERS Then
518 	-- store SQL error message on message stack for caller
519 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
520                           p_msg_name     => g_unexpected_error,
521                           p_token1       => g_sqlcode_token,
522                           p_token1_value => sqlcode,
523                           p_token2       => g_sqlerrm_token,
524                           p_token2_value => sqlerrm);
525 
526       -- notify caller of an UNEXPECTED error
527       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
528 
529 
530   END validate_Date_Next_Invoice;
531 
532 
533 
534 
535 
536 PROCEDURE validate_Amount(	x_return_status OUT NOCOPY varchar2,
537 					P_amount IN  NUMBER)
538   Is
539   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
540   Begin
541 
542 
543     -- call column length utility
544   /*
545   OKC_UTIL.CHECK_LENGTH
546   (
547 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
548             ,p_col_name      => 'Amount'
549             ,p_col_value     => P_amount
550             ,x_return_status => l_return_status
551    );
552   */
553 
554    -- verify that length is within allowed limits
555    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
556 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
557                           p_msg_name     => g_unexpected_error,
558                           p_token1       => g_sqlcode_token,
559                           p_token1_value => sqlcode,
560                           p_token2       => g_sqlerrm_token,
561                           p_token2_value => 'Amount Length');
562 
563 
564 	-- notify caller of an error
565 	x_return_status := OKC_API.G_RET_STS_ERROR;
566 	-- halt further validation of this column
567 	RAISE G_EXCEPTION_HALT_VALIDATION;
568   End If;
569 
570   Exception
571   When  G_EXCEPTION_HALT_VALIDATION Then
572 		NULL;
573   When OTHERS Then
574 	-- store SQL error message on message stack for caller
575 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
576                           p_msg_name     => g_unexpected_error,
577                           p_token1       => g_sqlcode_token,
578                           p_token1_value => sqlcode,
579                           p_token2       => g_sqlerrm_token,
580                           p_token2_value => sqlerrm);
581 
582       -- notify caller of an UNEXPECTED error
583       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
584   END validate_Amount;
585 
586 PROCEDURE validate_Bill_Action (	x_return_status OUT NOCOPY varchar2,
587 							 P_Bill_Action IN  Varchar2)
588   Is
589   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
590   Begin
591 
592   x_return_status := OKC_API.G_RET_STS_SUCCESS;
593 
594 
595 
596   -- call column length utility
597 
598   /*
599   OKC_UTIL.CHECK_LENGTH
600   (
601 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
602             ,p_col_name      => 'Bill_Action'
603             ,p_col_value     => P_Bill_Action
604             ,x_return_status => l_return_status
605    );
606   */
607 
608    -- verify that length is within allowed limits
609    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
610 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
611                           p_msg_name     => g_unexpected_error,
612                           p_token1       => g_sqlcode_token,
613                           p_token1_value => sqlcode,
614                           p_token2       => g_sqlerrm_token,
615                           p_token2_value => 'Bill_Action length');
616 
617 
618 	-- notify caller of an error
619 	x_return_status := OKC_API.G_RET_STS_ERROR;
620 	-- halt further validation of this column
621 	RAISE G_EXCEPTION_HALT_VALIDATION;
622   End If;
623 
624   Exception
625   When  G_EXCEPTION_HALT_VALIDATION Then
626 		NULL;
627   When OTHERS Then
628 	-- store SQL error message on message stack for caller
629 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
630                           p_msg_name     => g_unexpected_error,
631                           p_token1       => g_sqlcode_token,
632                           p_token1_value => sqlcode,
633                           p_token2       => g_sqlerrm_token,
634                           p_token2_value => sqlerrm);
635 
636       -- notify caller of an UNEXPECTED error
637       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
638   END validate_Bill_Action;
639 
640 PROCEDURE validate_sent_yn (	x_return_status OUT NOCOPY varchar2,
641 							 p_sent_yn IN  Varchar2)
642   Is
643   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
644   Begin
645 
646   x_return_status := OKC_API.G_RET_STS_SUCCESS;
647 
648 
649 
650   -- call column length utility
651 
652   /*
653   OKC_UTIL.CHECK_LENGTH
654   (
655 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
656             ,p_col_name      => 'Sent_yn'
657             ,p_col_value     => P_sent_yn
658             ,x_return_status => l_return_status
659    );
660   */
661 
662    -- verify that length is within allowed limits
663    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
664 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
665                           p_msg_name     => g_unexpected_error,
666                           p_token1       => g_sqlcode_token,
667                           p_token1_value => sqlcode,
668                           p_token2       => g_sqlerrm_token,
669                           p_token2_value => 'sent_yn');
670 
671 
672 	-- notify caller of an error
673 	x_return_status := OKC_API.G_RET_STS_ERROR;
674 	-- halt further validation of this column
675 	RAISE G_EXCEPTION_HALT_VALIDATION;
676   End If;
677 
678   Exception
679   When  G_EXCEPTION_HALT_VALIDATION Then
680 		NULL;
681   When OTHERS Then
682 	-- store SQL error message on message stack for caller
683 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
684                           p_msg_name     => g_unexpected_error,
685                           p_token1       => g_sqlcode_token,
686                           p_token1_value => sqlcode,
687                           p_token2       => g_sqlerrm_token,
688                           p_token2_value => sqlerrm);
689 
690       -- notify caller of an UNEXPECTED error
691       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
692   END validate_sent_yn;
693 
694 
695   PROCEDURE validate_currency_code (	x_return_status OUT NOCOPY varchar2,
696 							 p_currency_code IN  Varchar2)
697   Is
698   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
699   Begin
700 
701   x_return_status := OKC_API.G_RET_STS_SUCCESS;
702 
703 
704 
705   -- call column length utility
706 
707   /*
708   OKC_UTIL.CHECK_LENGTH
709   (
710 	     p_view_name     => 'OKS_BILL_CONT_LINES_V'
711             ,p_col_name      => 'currency_code'
712             ,p_col_value     => P_currency_code
713             ,x_return_status => l_return_status
714    );
715   */
716 
717    -- verify that length is within allowed limits
718    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
719 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
720                           p_msg_name     => g_unexpected_error,
721                           p_token1       => g_sqlcode_token,
722                           p_token1_value => sqlcode,
723                           p_token2       => g_sqlerrm_token,
724                           p_token2_value => 'currency_code');
725 
726 
727 	-- notify caller of an error
728 	x_return_status := OKC_API.G_RET_STS_ERROR;
729 	-- halt further validation of this column
730 	RAISE G_EXCEPTION_HALT_VALIDATION;
731   End If;
732 
733   Exception
734   When  G_EXCEPTION_HALT_VALIDATION Then
735 		NULL;
736   When OTHERS Then
737 	-- store SQL error message on message stack for caller
738 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
739                           p_msg_name     => g_unexpected_error,
740                           p_token1       => g_sqlcode_token,
741                           p_token1_value => sqlcode,
742                           p_token2       => g_sqlerrm_token,
743                           p_token2_value => sqlerrm);
744 
745       -- notify caller of an UNEXPECTED error
746       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
747   END validate_currency_code;
748 
749 PROCEDURE validate_objvernum(x_return_status OUT NOCOPY varchar2,
750 					 P_object_version_number IN  Number)
751   Is
752   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
753   Begin
754 
755   x_return_status := OKC_API.G_RET_STS_SUCCESS;
756 
757   If p_object_version_number = OKC_API.G_MISS_NUM OR
758        p_object_version_number IS NULL
759   Then
760       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'object_version_number');
761       x_return_status := OKC_API.G_RET_STS_ERROR;
762 	RAISE G_EXCEPTION_HALT_VALIDATION;
763   End If;
764 
765   Exception
766   When  G_EXCEPTION_HALT_VALIDATION Then
767 		NULL;
768   When OTHERS Then
769 	-- store SQL error message on message stack for caller
770 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
771                           p_msg_name     => g_unexpected_error,
772                           p_token1       => g_sqlcode_token,
773                           p_token1_value => sqlcode,
774                           p_token2       => g_sqlerrm_token,
775                           p_token2_value => sqlerrm);
776 
777       -- notify caller of an UNEXPECTED error
778       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
779   END validate_objvernum;
780 
781 
782 PROCEDURE validate_attribute_category(	x_return_status OUT NOCOPY varchar2,
783 							 P_attribute_category IN  varchar)
784   Is
785   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
786   Begin
787 
788   x_return_status := OKC_API.G_RET_STS_SUCCESS;
789 
790   -- call column length utility
791 
792   Exception
793   When  G_EXCEPTION_HALT_VALIDATION Then
794 		NULL;
795   When OTHERS Then
796 	-- store SQL error message on message stack for caller
797 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
798                           p_msg_name     => g_unexpected_error,
799                           p_token1       => g_sqlcode_token,
800                           p_token1_value => sqlcode,
801                           p_token2       => g_sqlerrm_token,
802                           p_token2_value => sqlerrm);
803 
804       -- notify caller of an UNEXPECTED error
805       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
806   END validate_attribute_category;
807 
808 
809 PROCEDURE validate_attribute1(	x_return_status OUT NOCOPY varchar2,
810 							 P_attribute1 IN  varchar2)
811   Is
812   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
813   Begin
814 
815   x_return_status := OKC_API.G_RET_STS_SUCCESS;
816 
817   -- call column length utility
818   /*
819   OKC_UTIL.CHECK_LENGTH
820   (
821 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
822             ,p_col_name      => 'attribute1'
823             ,p_col_value     => p_attribute1
824             ,x_return_status => l_return_status
825    );
826   */
827 
828    -- verify that length is within allowed limits
829    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
830 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
831                           p_msg_name     => g_unexpected_error,
832                           p_token1       => g_sqlcode_token,
833                           p_token1_value => sqlcode,
834                           p_token2       => g_sqlerrm_token,
835                           p_token2_value => 'attribute 1 Length');
836 
837 
838 	-- notify caller of an error
839 	x_return_status := OKC_API.G_RET_STS_ERROR;
840 	-- halt further validation of this column
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 	-- store SQL error message on message stack for caller
849 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
850                           p_msg_name     => g_unexpected_error,
851                           p_token1       => g_sqlcode_token,
852                           p_token1_value => sqlcode,
853                           p_token2       => g_sqlerrm_token,
854                           p_token2_value => sqlerrm);
855 
856       -- notify caller of an UNEXPECTED error
857       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
858   END validate_attribute1;
859 PROCEDURE validate_attribute2(	x_return_status OUT NOCOPY varchar2,
860 							 P_attribute2 IN  varchar2)
861   Is
862   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
863   Begin
864 
865   x_return_status := OKC_API.G_RET_STS_SUCCESS;
866 
867   -- call column length utility
868   /*
869   OKC_UTIL.CHECK_LENGTH
870   (
871 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
872             ,p_col_name      => 'attribute2'
873             ,p_col_value     => p_attribute2
874             ,x_return_status => l_return_status
875    );
876   */
877 
878    -- verify that length is within allowed limits
879    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
880 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
881                           p_msg_name     => g_unexpected_error,
882                           p_token1       => g_sqlcode_token,
883                           p_token1_value => sqlcode,
884                           p_token2       => g_sqlerrm_token,
885                           p_token2_value => 'attribute 2 Length');
886 
887 	-- notify caller of an error
888 	x_return_status := OKC_API.G_RET_STS_ERROR;
889 	-- halt further validation of this column
890 	RAISE G_EXCEPTION_HALT_VALIDATION;
891   End If;
892 
893   Exception
894   When  G_EXCEPTION_HALT_VALIDATION Then
895 		NULL;
896   When OTHERS Then
897 	-- store SQL error message on message stack for caller
898 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
899                           p_msg_name     => g_unexpected_error,
900                           p_token1       => g_sqlcode_token,
901                           p_token1_value => sqlcode,
902                           p_token2       => g_sqlerrm_token,
903                           p_token2_value => sqlerrm);
904 
905       -- notify caller of an UNEXPECTED error
906       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
907   END validate_attribute2;
908 
909 
910 PROCEDURE validate_attribute3(	x_return_status OUT NOCOPY varchar2,
911 							 P_attribute3 IN  varchar2)
912   Is
913   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
914   Begin
915 
916   x_return_status := OKC_API.G_RET_STS_SUCCESS;
917 
918   -- call column length utility
919   /*
920   OKC_UTIL.CHECK_LENGTH
921   (
922 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
923             ,p_col_name      => 'attribute3'
924             ,p_col_value     => p_attribute3
925             ,x_return_status => l_return_status
926    );
927   */
928 
929    -- verify that length is within allowed limits
930    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
931 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
932                           p_msg_name     => g_unexpected_error,
933                           p_token1       => g_sqlcode_token,
934                           p_token1_value => sqlcode,
935                           p_token2       => g_sqlerrm_token,
936                           p_token2_value => 'attribute 3 Length');
937 
938 	-- notify caller of an error
939 	x_return_status := OKC_API.G_RET_STS_ERROR;
940 	-- halt further validation of this column
941 	RAISE G_EXCEPTION_HALT_VALIDATION;
942   End If;
943 
944   Exception
945   When  G_EXCEPTION_HALT_VALIDATION Then
946 		NULL;
947   When OTHERS Then
948 	-- store SQL error message on message stack for caller
949 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
950                           p_msg_name     => g_unexpected_error,
951                           p_token1       => g_sqlcode_token,
952                           p_token1_value => sqlcode,
953                           p_token2       => g_sqlerrm_token,
954                           p_token2_value => sqlerrm);
955 
956       -- notify caller of an UNEXPECTED error
957       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
958   END validate_attribute3;
959 
960 PROCEDURE validate_attribute4 (x_return_status OUT NOCOPY varchar2,
961 							 P_attribute4 IN  varchar2)
962   Is
963   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
964   Begin
965 
966   x_return_status := OKC_API.G_RET_STS_SUCCESS;
967 
968   -- call column length utility
969   /*
970   OKC_UTIL.CHECK_LENGTH
971   (
972 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
973             ,p_col_name      => 'attribute4'
974             ,p_col_value     => p_attribute4
975             ,x_return_status => l_return_status
976    );
977   */
978 
979    -- verify that length is within allowed limits
980    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
981 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
982                           p_msg_name     => g_unexpected_error,
983                           p_token1       => g_sqlcode_token,
984                           p_token1_value => sqlcode,
985                           p_token2       => g_sqlerrm_token,
986                           p_token2_value => 'attribute 4 Length');
987 
988 	-- notify caller of an error
989 	x_return_status := OKC_API.G_RET_STS_ERROR;
990 	-- halt further validation of this column
991 	RAISE G_EXCEPTION_HALT_VALIDATION;
992   End If;
993 
994   Exception
995   When  G_EXCEPTION_HALT_VALIDATION Then
996 		NULL;
997   When OTHERS Then
998 	-- store SQL error message on message stack for caller
999 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1000                           p_msg_name     => g_unexpected_error,
1001                           p_token1       => g_sqlcode_token,
1002                           p_token1_value => sqlcode,
1003                           p_token2       => g_sqlerrm_token,
1004                           p_token2_value => sqlerrm);
1005 
1006       -- notify caller of an UNEXPECTED error
1007       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1008   END validate_attribute4;
1009 
1010 
1011 PROCEDURE validate_attribute5(	x_return_status OUT NOCOPY varchar2,
1012 							 P_attribute5 IN  varchar2)
1013   Is
1014   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1015   Begin
1016 
1017   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1018 
1019   -- call column length utility
1020   /*
1021   OKC_UTIL.CHECK_LENGTH
1022   (
1023 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1024             ,p_col_name      => 'attribute5'
1025             ,p_col_value     => p_attribute5
1026             ,x_return_status => l_return_status
1027    );
1028   */
1029 
1030    -- verify that length is within allowed limits
1031    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1032 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1033                           p_msg_name     => g_unexpected_error,
1034                           p_token1       => g_sqlcode_token,
1035                           p_token1_value => sqlcode,
1036                           p_token2       => g_sqlerrm_token,
1037                           p_token2_value => 'attribute 5 Length');
1038 
1039 	-- notify caller of an error
1040 	x_return_status := OKC_API.G_RET_STS_ERROR;
1041 	-- halt further validation of this column
1042 	RAISE G_EXCEPTION_HALT_VALIDATION;
1043   End If;
1044 
1045   Exception
1046   When  G_EXCEPTION_HALT_VALIDATION Then
1047 		NULL;
1048   When OTHERS Then
1049 	-- store SQL error message on message stack for caller
1050 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1051                           p_msg_name     => g_unexpected_error,
1052                           p_token1       => g_sqlcode_token,
1053                           p_token1_value => sqlcode,
1054                           p_token2       => g_sqlerrm_token,
1055                           p_token2_value => sqlerrm);
1056 
1057       -- notify caller of an UNEXPECTED error
1058       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1059   END validate_attribute5;
1060 
1061 
1062 PROCEDURE validate_attribute6(	x_return_status OUT NOCOPY varchar2,
1063 							 P_attribute6 IN  varchar2)
1064   Is
1065   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1066   Begin
1067 
1068   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1069 
1070   -- call column length utility
1071   /*
1072   OKC_UTIL.CHECK_LENGTH
1073   (
1074 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1075             ,p_col_name      => 'attribute6'
1076             ,p_col_value     => p_attribute6
1077             ,x_return_status => l_return_status
1078    );
1079   */
1080 
1081    -- verify that length is within allowed limits
1082    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1083 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1084                           p_msg_name     => g_unexpected_error,
1085                           p_token1       => g_sqlcode_token,
1086                           p_token1_value => sqlcode,
1087                           p_token2       => g_sqlerrm_token,
1088                           p_token2_value => 'attribute 6 Length');
1089 
1090 	-- notify caller of an error
1091 	x_return_status := OKC_API.G_RET_STS_ERROR;
1092 	-- halt further validation of this column
1093 	RAISE G_EXCEPTION_HALT_VALIDATION;
1094   End If;
1095 
1096   Exception
1097   When  G_EXCEPTION_HALT_VALIDATION Then
1098 		NULL;
1099   When OTHERS Then
1100 	-- store SQL error message on message stack for caller
1101 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1102                           p_msg_name     => g_unexpected_error,
1103                           p_token1       => g_sqlcode_token,
1104                           p_token1_value => sqlcode,
1105                           p_token2       => g_sqlerrm_token,
1106                           p_token2_value => sqlerrm);
1107 
1108       -- notify caller of an UNEXPECTED error
1109       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1110   END validate_attribute6;
1111 
1112 
1113 PROCEDURE validate_attribute7(	x_return_status OUT NOCOPY varchar2,
1114 							 P_attribute7 IN  varchar2)
1115   Is
1116   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1117   Begin
1118 
1119   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1120 
1121   -- call column length utility
1122   /*
1123   OKC_UTIL.CHECK_LENGTH
1124   (
1125 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1126             ,p_col_name      => 'attribute7'
1127             ,p_col_value     => p_attribute7
1128             ,x_return_status => l_return_status
1129    );
1130   */
1131 
1132    -- verify that length is within allowed limits
1133    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1134 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1135                           p_msg_name     => g_unexpected_error,
1136                           p_token1       => g_sqlcode_token,
1137                           p_token1_value => sqlcode,
1138                           p_token2       => g_sqlerrm_token,
1139                           p_token2_value => 'attribute 7 Length');
1140 
1141 	-- notify caller of an error
1142 	x_return_status := OKC_API.G_RET_STS_ERROR;
1143 	-- halt further validation of this column
1144 	RAISE G_EXCEPTION_HALT_VALIDATION;
1145   End If;
1146 
1147   Exception
1148   When  G_EXCEPTION_HALT_VALIDATION Then
1149 		NULL;
1150   When OTHERS Then
1151 	-- store SQL error message on message stack for caller
1152 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1153                           p_msg_name     => g_unexpected_error,
1154                           p_token1       => g_sqlcode_token,
1155                           p_token1_value => sqlcode,
1156                           p_token2       => g_sqlerrm_token,
1157                           p_token2_value => sqlerrm);
1158 
1159       -- notify caller of an UNEXPECTED error
1160       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1161   END validate_attribute7;
1162 
1163 
1164 
1165 PROCEDURE validate_attribute8 (x_return_status OUT NOCOPY varchar2,
1166 							 P_attribute8 IN  varchar2)
1167   Is
1168   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1169   Begin
1170 
1171   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1172 
1173   -- call column length utility
1174   /*
1175   OKC_UTIL.CHECK_LENGTH
1176   (
1177 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1178             ,p_col_name      => 'attribute8'
1179             ,p_col_value     => p_attribute8
1180             ,x_return_status => l_return_status
1181    );
1182   */
1183 
1184    -- verify that length is within allowed limits
1185    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1186 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1187                           p_msg_name     => g_unexpected_error,
1188                           p_token1       => g_sqlcode_token,
1189                           p_token1_value => sqlcode,
1190                           p_token2       => g_sqlerrm_token,
1191                           p_token2_value => 'attribute 8 Length');
1192 
1193 	-- notify caller of an error
1194 	x_return_status := OKC_API.G_RET_STS_ERROR;
1195 	-- halt further validation of this column
1196 	RAISE G_EXCEPTION_HALT_VALIDATION;
1197   End If;
1198 
1199   Exception
1200   When  G_EXCEPTION_HALT_VALIDATION Then
1201 		NULL;
1202   When OTHERS Then
1203 	-- store SQL error message on message stack for caller
1204 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1205                           p_msg_name     => g_unexpected_error,
1206                           p_token1       => g_sqlcode_token,
1207                           p_token1_value => sqlcode,
1208                           p_token2       => g_sqlerrm_token,
1209                           p_token2_value => sqlerrm);
1210 
1211       -- notify caller of an UNEXPECTED error
1212       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1213   END validate_attribute8;
1214 
1215 
1216 
1217 PROCEDURE validate_attribute9(	x_return_status OUT NOCOPY varchar2,
1218 							 P_attribute9 IN  varchar2)
1219   Is
1220   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1221   Begin
1222 
1223   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1224 
1225   -- call column length utility
1226   /*
1227   OKC_UTIL.CHECK_LENGTH
1228   (
1229 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1230             ,p_col_name      => 'attribute9'
1231             ,p_col_value     => p_attribute9
1232             ,x_return_status => l_return_status
1233    );
1234   */
1235 
1236    -- verify that length is within allowed limits
1237    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1238 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1239                           p_msg_name     => g_unexpected_error,
1240                           p_token1       => g_sqlcode_token,
1241                           p_token1_value => sqlcode,
1242                           p_token2       => g_sqlerrm_token,
1243                           p_token2_value => 'attribute 9 Length');
1244 
1245 	-- notify caller of an error
1246 	x_return_status := OKC_API.G_RET_STS_ERROR;
1247 	-- halt further validation of this column
1248 	RAISE G_EXCEPTION_HALT_VALIDATION;
1249   End If;
1250 
1251   Exception
1252   When  G_EXCEPTION_HALT_VALIDATION Then
1253 		NULL;
1254   When OTHERS Then
1255 	-- store SQL error message on message stack for caller
1256 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1257                           p_msg_name     => g_unexpected_error,
1258                           p_token1       => g_sqlcode_token,
1259                           p_token1_value => sqlcode,
1260                           p_token2       => g_sqlerrm_token,
1261                           p_token2_value => sqlerrm);
1262 
1263       -- notify caller of an UNEXPECTED error
1264       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1265   END validate_attribute9;
1266 
1267 
1268 PROCEDURE validate_attribute10(	x_return_status OUT NOCOPY varchar2,
1269 							 P_attribute10 IN  varchar2)
1270   Is
1271   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1272   Begin
1273 
1274   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1275 
1276   -- call column length utility
1277   /*
1278   OKC_UTIL.CHECK_LENGTH
1279   (
1280 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1281             ,p_col_name      => 'attribute10'
1282             ,p_col_value     => p_attribute10
1283             ,x_return_status => l_return_status
1284    );
1285   */
1286 
1287    -- verify that length is within allowed limits
1288    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1289 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1290                           p_msg_name     => g_unexpected_error,
1291                           p_token1       => g_sqlcode_token,
1292                           p_token1_value => sqlcode,
1293                           p_token2       => g_sqlerrm_token,
1294                           p_token2_value => 'attribute 10 Length');
1295 
1296 	-- notify caller of an error
1297 	x_return_status := OKC_API.G_RET_STS_ERROR;
1298 	-- halt further validation of this column
1299 	RAISE G_EXCEPTION_HALT_VALIDATION;
1300   End If;
1301 
1302   Exception
1303   When  G_EXCEPTION_HALT_VALIDATION Then
1304 		NULL;
1305   When OTHERS Then
1306 	-- store SQL error message on message stack for caller
1307 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1308                           p_msg_name     => g_unexpected_error,
1309                           p_token1       => g_sqlcode_token,
1310                           p_token1_value => sqlcode,
1311                           p_token2       => g_sqlerrm_token,
1312                           p_token2_value => sqlerrm);
1313 
1314       -- notify caller of an UNEXPECTED error
1315       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1316   END validate_attribute10;
1317 
1318 
1319 
1320 PROCEDURE validate_attribute11(	x_return_status OUT NOCOPY varchar2,
1321 							 P_attribute11 IN  varchar2)
1322   Is
1323   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1324   Begin
1325 
1326   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1327 
1328   -- call column length utility
1329 
1330   /*
1331   OKC_UTIL.CHECK_LENGTH
1332   (
1333 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1334             ,p_col_name      => 'attribute11'
1335             ,p_col_value     => p_attribute11
1336             ,x_return_status => l_return_status
1337    );
1338   */
1339 
1340    -- verify that length is within allowed limits
1341    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1342 OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1343                           p_msg_name     => g_unexpected_error,
1344                           p_token1       => g_sqlcode_token,
1345                           p_token1_value => sqlcode,
1346                           p_token2       => g_sqlerrm_token,
1347                           p_token2_value => 'attribute 11 Length');
1348 
1349 	-- notify caller of an error
1350 	x_return_status := OKC_API.G_RET_STS_ERROR;
1351 	-- halt further validation of this column
1352 	RAISE G_EXCEPTION_HALT_VALIDATION;
1353   End If;
1354 
1355   Exception
1356   When  G_EXCEPTION_HALT_VALIDATION Then
1357 		NULL;
1358   When OTHERS Then
1359 	-- store SQL error message on message stack for caller
1360 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1361                           p_msg_name     => g_unexpected_error,
1362                           p_token1       => g_sqlcode_token,
1363                           p_token1_value => sqlcode,
1364                           p_token2       => g_sqlerrm_token,
1365                           p_token2_value => sqlerrm);
1366 
1367       -- notify caller of an UNEXPECTED error
1368       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1369   END validate_attribute11;
1370 
1371 
1372 
1373 
1374 PROCEDURE validate_attribute12(	x_return_status OUT NOCOPY varchar2,
1375 							 P_attribute12 IN  varchar2)
1376   Is
1377   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1378   Begin
1379 
1380   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1381 
1382   -- call column length utility
1383   /*
1384   OKC_UTIL.CHECK_LENGTH
1385   (
1386 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1387             ,p_col_name      => 'attribute12'
1388             ,p_col_value     => p_attribute12
1389             ,x_return_status => l_return_status
1390    );
1391   */
1392 
1393    -- verify that length is within allowed limits
1394    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1395 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1396                           p_msg_name     => g_unexpected_error,
1397                           p_token1       => g_sqlcode_token,
1398                           p_token1_value => sqlcode,
1399                           p_token2       => g_sqlerrm_token,
1400                           p_token2_value => 'attribute 12 Length');
1401 
1402 	-- notify caller of an error
1403 	x_return_status := OKC_API.G_RET_STS_ERROR;
1404 	-- halt further validation of this column
1405 	RAISE G_EXCEPTION_HALT_VALIDATION;
1406   End If;
1407 
1408   Exception
1409   When  G_EXCEPTION_HALT_VALIDATION Then
1410 		NULL;
1411   When OTHERS Then
1412 	-- store SQL error message on message stack for caller
1413 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1414                           p_msg_name     => g_unexpected_error,
1415                           p_token1       => g_sqlcode_token,
1416                           p_token1_value => sqlcode,
1417                           p_token2       => g_sqlerrm_token,
1418                           p_token2_value => sqlerrm);
1419 
1420       -- notify caller of an UNEXPECTED error
1421       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1422   END validate_attribute12;
1423 
1424 
1425 
1426 
1427 PROCEDURE validate_attribute13(	x_return_status OUT NOCOPY varchar2,
1428 							 P_attribute13 IN  varchar2)
1429   Is
1430   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1431   Begin
1432 
1433   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1434 
1435   -- call column length utility
1436   /*
1437   OKC_UTIL.CHECK_LENGTH
1438   (
1439 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1440             ,p_col_name      => 'attribute13'
1441             ,p_col_value     => p_attribute13
1442             ,x_return_status => l_return_status
1443    );
1444   */
1445 
1446    -- verify that length is within allowed limits
1447    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1448 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1449                           p_msg_name     => g_unexpected_error,
1450                           p_token1       => g_sqlcode_token,
1451                           p_token1_value => sqlcode,
1452                           p_token2       => g_sqlerrm_token,
1453                           p_token2_value => 'attribute 13 Length');
1454 
1455 	-- notify caller of an error
1456 	x_return_status := OKC_API.G_RET_STS_ERROR;
1457 	-- halt further validation of this column
1458 	RAISE G_EXCEPTION_HALT_VALIDATION;
1459   End If;
1460 
1461   Exception
1462   When  G_EXCEPTION_HALT_VALIDATION Then
1463 		NULL;
1464   When OTHERS Then
1465 	-- store SQL error message on message stack for caller
1466 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1467                           p_msg_name     => g_unexpected_error,
1468                           p_token1       => g_sqlcode_token,
1469                           p_token1_value => sqlcode,
1470                           p_token2       => g_sqlerrm_token,
1471                           p_token2_value => sqlerrm);
1472 
1473       -- notify caller of an UNEXPECTED error
1474       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1475   END validate_attribute13;
1476 
1477 
1478 
1479 
1480 PROCEDURE validate_attribute14(	x_return_status OUT NOCOPY varchar2,
1481 							 P_attribute14 IN  varchar2)
1482   Is
1483   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1484   Begin
1485 
1486   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1487 
1488   -- call column length utility
1489   /*
1490   OKC_UTIL.CHECK_LENGTH
1491   (
1492 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1493             ,p_col_name      => 'attribute14'
1494             ,p_col_value     => p_attribute14
1495             ,x_return_status => l_return_status
1496    );
1497   */
1498 
1499    -- verify that length is within allowed limits
1500    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1501 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1502                           p_msg_name     => g_unexpected_error,
1503                           p_token1       => g_sqlcode_token,
1504                           p_token1_value => sqlcode,
1505                           p_token2       => g_sqlerrm_token,
1506                           p_token2_value => 'attribute 14 Length');
1507 
1508 	-- notify caller of an error
1509 	x_return_status := OKC_API.G_RET_STS_ERROR;
1510 	-- halt further validation of this column
1511 	RAISE G_EXCEPTION_HALT_VALIDATION;
1512   End If;
1513 
1514   Exception
1515   When  G_EXCEPTION_HALT_VALIDATION Then
1516 		NULL;
1517   When OTHERS Then
1518 	-- store SQL error message on message stack for caller
1519 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1520                           p_msg_name     => g_unexpected_error,
1521                           p_token1       => g_sqlcode_token,
1522                           p_token1_value => sqlcode,
1523                           p_token2       => g_sqlerrm_token,
1524                           p_token2_value => sqlerrm);
1525 
1526       -- notify caller of an UNEXPECTED error
1527       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1528   END validate_attribute14;
1529 
1530 
1531 
1532 PROCEDURE validate_attribute15(	x_return_status OUT NOCOPY varchar2,
1533 							 P_attribute15 IN  varchar2)
1534   Is
1535   l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
1536   Begin
1537   x_return_status := OKC_API.G_RET_STS_SUCCESS;
1538 
1539   -- call column length utility
1540   /*
1541   OKC_UTIL.CHECK_LENGTH
1542   (
1543 		 p_view_name     => 'OKS_BILL_CONT_LINES_V'
1544             ,p_col_name      => 'attribute15'
1545             ,p_col_value     => p_attribute15
1546             ,x_return_status => l_return_status
1547    );
1548   */
1549 
1550    -- verify that length is within allowed limits
1551    If (l_return_status <> OKC_API.G_RET_STS_SUCCESS) then
1552 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1553                           p_msg_name     => g_unexpected_error,
1554                           p_token1       => g_sqlcode_token,
1555                           p_token1_value => sqlcode,
1556                           p_token2       => g_sqlerrm_token,
1557                           p_token2_value => 'attribute 15 Length');
1558 
1559 	-- notify caller of an error
1560 	x_return_status := OKC_API.G_RET_STS_ERROR;
1561 	-- halt further validation of this column
1562 	RAISE G_EXCEPTION_HALT_VALIDATION;
1563   End If;
1564 
1565   Exception
1566   When  G_EXCEPTION_HALT_VALIDATION Then
1567 		NULL;
1568   When OTHERS Then
1569 	-- store SQL error message on message stack for caller
1570 	OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
1571                           p_msg_name     => g_unexpected_error,
1572                           p_token1       => g_sqlcode_token,
1573                           p_token1_value => sqlcode,
1574                           p_token2       => g_sqlerrm_token,
1575                           p_token2_value => sqlerrm);
1576 
1577       -- notify caller of an UNEXPECTED error
1578       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1579   END validate_attribute15;
1580 
1581 ---------------------------------------------------
1582   -- Validate_Attributes for:OKS_BILL_CONT_LINES_V --
1583   ---------------------------------------------------
1584  FUNCTION Validate_Attributes (
1585     p_bclv_rec IN  bclv_rec_type
1586   )
1587   Return VARCHAR2 Is
1588     l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1589     x_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1590 
1591   Begin
1592   -- call OKC_UTIL.ADD_VIEW to prepare the PL/SQL table to hold columns of view
1593 
1594     OKC_UTIL.ADD_VIEW('OKS_BILL_CONT_LINES_V',x_return_status);
1595 
1596     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1597        IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1598           -- need to leave
1599           l_return_status := x_return_status;
1600           RAISE G_EXCEPTION_HALT_VALIDATION;
1601        ELSE
1602           -- record that there is a error
1603           l_return_status := x_return_status;
1604        END IF;
1605     END IF;
1606 
1607     --Column Level Validation
1608 
1609     --ID
1610     validate_id(x_return_status, p_bclv_rec.id);
1611 
1612     -- store the highest degree of error
1613     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1614         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1615         -- need to leave
1616         l_return_status := x_return_status;
1617         RAISE G_EXCEPTION_HALT_VALIDATION;
1618         ELSE
1619         -- record that there was an error
1620         l_return_status := x_return_status;
1621         END IF;
1622     END IF;
1623 
1624     --OBJECT_VERSION_NUMBER
1625     validate_objvernum(x_return_status, p_bclv_rec.object_version_number);
1626 
1627     -- store the highest degree of error
1628     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1629         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1630         -- need to leave
1631         l_return_status := x_return_status;
1632         RAISE G_EXCEPTION_HALT_VALIDATION;
1633         ELSE
1634         -- record that there was an error
1635         l_return_status := x_return_status;
1636         END IF;
1637     END IF;
1638     --Cle_ID
1639 	 validate_cle_id(x_return_status, p_bclv_rec.cle_id);
1640     -- store the highest degree of error
1641     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1642         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1643         -- need to leave
1644         l_return_status := x_return_status;
1645         RAISE G_EXCEPTION_HALT_VALIDATION;
1646         ELSE
1647         -- record that there was an error
1648         l_return_status := x_return_status;
1649         END IF;
1650     END IF;
1651 
1652 	--btn_id
1653 
1654  	validate_btn_id(x_return_status, p_bclv_rec.btn_id);
1655     -- store the highest degree of error
1656     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1657 
1658         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1659 
1660         -- need to leave
1661         l_return_status := x_return_status;
1662         RAISE G_EXCEPTION_HALT_VALIDATION;
1663         ELSE
1664         -- record that there was an error
1665         l_return_status := x_return_status;
1666         END IF;
1667     END IF;
1668 
1669 	--DATE_BILLED_FROM
1670 	 validate_date_billed_from(x_return_status, p_bclv_rec.date_billed_from);
1671 
1672     -- store the highest degree of error
1673     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1674         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1675 
1676 
1677         -- need to leave
1678         l_return_status := x_return_status;
1679         RAISE G_EXCEPTION_HALT_VALIDATION;
1680         ELSE
1681         -- record that there was an error
1682         l_return_status := x_return_status;
1683         END IF;
1684     END IF;
1685 
1686 	--DATE_BILLED_TO
1687 	 validate_date_billed_to(x_return_status, p_bclv_rec.date_billed_to);
1688 
1689     -- store the highest degree of error
1690     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1691         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1692 
1693         -- need to leave
1694         l_return_status := x_return_status;
1695         RAISE G_EXCEPTION_HALT_VALIDATION;
1696         ELSE
1697         -- record that there was an error
1698         l_return_status := x_return_status;
1699         END IF;
1700     END IF;
1701 
1702 
1703 	--DATE_NEXT_INVOICE
1704 		validate_date_next_invoice(x_return_status, p_bclv_rec.date_next_invoice);
1705     -- store the highest degree of error
1706     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1707         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1708         -- need to leave
1709         l_return_status := x_return_status;
1710         RAISE G_EXCEPTION_HALT_VALIDATION;
1711         ELSE
1712         -- record that there was an error
1713         l_return_status := x_return_status;
1714         END IF;
1715     END IF;
1716 
1717 	--AMOUNT
1718 		validate_amount(x_return_status, p_bclv_rec.amount);
1719 
1720     -- store the highest degree of error
1721     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1722         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1723         -- need to leave
1724         l_return_status := x_return_status;
1725         RAISE G_EXCEPTION_HALT_VALIDATION;
1726         ELSE
1727         -- record that there was an error
1728         l_return_status := x_return_status;
1729         END IF;
1730     END IF;
1731 
1732 
1733 	--BILL_ACTION
1734 		validate_bill_action(x_return_status, p_bclv_rec.bill_action);
1735     -- store the highest degree of error
1736     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1737         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1738         -- need to leave
1739         l_return_status := x_return_status;
1740         RAISE G_EXCEPTION_HALT_VALIDATION;
1741         ELSE
1742         -- record that there was an error
1743         l_return_status := x_return_status;
1744         END IF;
1745     END IF;
1746 
1747 	--sent_yn
1748 		validate_sent_yn(x_return_status, p_bclv_rec.sent_yn);
1749     -- store the highest degree of error
1750     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1751         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1752         -- need to leave
1753         l_return_status := x_return_status;
1754         RAISE G_EXCEPTION_HALT_VALIDATION;
1755         ELSE
1756         -- record that there was an error
1757         l_return_status := x_return_status;
1758         END IF;
1759     END IF;
1760 
1761       --currency_code
1762                 validate_currency_code(x_return_status, p_bclv_rec.currency_code);
1763     -- store the highest degree of error
1764     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1765         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1766         -- need to leave
1767         l_return_status := x_return_status;
1768         RAISE G_EXCEPTION_HALT_VALIDATION;
1769         ELSE
1770         -- record that there was an error
1771         l_return_status := x_return_status;
1772         END IF;
1773     END IF;
1774 
1775 	--ATTRIBUTE_CATEGORY
1776 		validate_attribute_category(x_return_status, p_bclv_rec.attribute_category);
1777 
1778     -- store the highest degree of error
1779     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1780         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1781         -- need to leave
1782         l_return_status := x_return_status;
1783         RAISE G_EXCEPTION_HALT_VALIDATION;
1784         ELSE
1785         -- record that there was an error
1786         l_return_status := x_return_status;
1787         END IF;
1788     END IF;
1789 
1790 
1791 	--ATTRIBUTE1
1792 
1793 		validate_attribute1(x_return_status, p_bclv_rec.attribute1);
1794 
1795     -- store the highest degree of error
1796     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1797         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1798         -- need to leave
1799         l_return_status := x_return_status;
1800         RAISE G_EXCEPTION_HALT_VALIDATION;
1801         ELSE
1802         -- record that there was an error
1803         l_return_status := x_return_status;
1804         END IF;
1805     END IF;
1806 
1807 	--ATTRIBUTE2
1808 
1809 		validate_attribute2(x_return_status, p_bclv_rec.attribute2);
1810 
1811     -- store the highest degree of error
1812     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1813         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1814         -- need to leave
1815         l_return_status := x_return_status;
1816         RAISE G_EXCEPTION_HALT_VALIDATION;
1817         ELSE
1818         -- record that there was an error
1819         l_return_status := x_return_status;
1820         END IF;
1821     END IF;
1822 
1823 
1824 --ATTRIBUTE3
1825 
1826 		validate_attribute3(x_return_status, p_bclv_rec.attribute3);
1827 
1828     -- store the highest degree of error
1829     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1830         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1831         -- need to leave
1832         l_return_status := x_return_status;
1833         RAISE G_EXCEPTION_HALT_VALIDATION;
1834         ELSE
1835         -- record that there was an error
1836         l_return_status := x_return_status;
1837         END IF;
1838     END IF;
1839 
1840 
1841 --ATTRIBUTE4
1842 		validate_attribute4(x_return_status, p_bclv_rec.attribute4);
1843 
1844     -- store the highest degree of error
1845     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1846         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1847         -- need to leave
1848         l_return_status := x_return_status;
1849         RAISE G_EXCEPTION_HALT_VALIDATION;
1850         ELSE
1851         -- record that there was an error
1852         l_return_status := x_return_status;
1853         END IF;
1854     END IF;
1855 
1856 
1857 	--ATTRIBUTE5
1858 		validate_attribute5(x_return_status, p_bclv_rec.attribute5);
1859 
1860     -- store the highest degree of error
1861     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1862         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1863         -- need to leave
1864         l_return_status := x_return_status;
1865         RAISE G_EXCEPTION_HALT_VALIDATION;
1866         ELSE
1867         -- record that there was an error
1868         l_return_status := x_return_status;
1869         END IF;
1870     END IF;
1871 
1872 
1873 	--ATTRIBUTE6
1874 
1875 		validate_attribute6(x_return_status, p_bclv_rec.attribute6);
1876 
1877     -- store the highest degree of error
1878     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1879         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1880         -- need to leave
1881         l_return_status := x_return_status;
1882         RAISE G_EXCEPTION_HALT_VALIDATION;
1883         ELSE
1884         -- record that there was an error
1885         l_return_status := x_return_status;
1886         END IF;
1887     END IF;
1888 
1889 
1890 	--ATTRIBUTE7
1891 
1892 		validate_attribute7(x_return_status, p_bclv_rec.attribute7);
1893 
1894     -- store the highest degree of error
1895     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1896         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1897         -- need to leave
1898         l_return_status := x_return_status;
1899         RAISE G_EXCEPTION_HALT_VALIDATION;
1900         ELSE
1901         -- record that there was an error
1902         l_return_status := x_return_status;
1903         END IF;
1904     END IF;
1905 
1906 
1907 	--ATTRIBUTE8
1908 		validate_attribute8(x_return_status, p_bclv_rec.attribute8);
1909 
1910     -- store the highest degree of error
1911     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1912         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1913         -- need to leave
1914         l_return_status := x_return_status;
1915         RAISE G_EXCEPTION_HALT_VALIDATION;
1916         ELSE
1917         -- record that there was an error
1918         l_return_status := x_return_status;
1919         END IF;
1920     END IF;
1921 
1922 
1923 	--ATTRIBUTE9
1924 		validate_attribute9(x_return_status, p_bclv_rec.attribute9);
1925 
1926     -- store the highest degree of error
1927     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1928         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1929         -- need to leave
1930         l_return_status := x_return_status;
1931         RAISE G_EXCEPTION_HALT_VALIDATION;
1932         ELSE
1933         -- record that there was an error
1934         l_return_status := x_return_status;
1935         END IF;
1936     END IF;
1937 
1938 
1939 	--ATTRIBUTE10
1940 
1941 		validate_attribute10(x_return_status, p_bclv_rec.attribute10);
1942 
1943     -- store the highest degree of error
1944     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1945         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1946         -- need to leave
1947         l_return_status := x_return_status;
1948         RAISE G_EXCEPTION_HALT_VALIDATION;
1949         ELSE
1950         -- record that there was an error
1951         l_return_status := x_return_status;
1952         END IF;
1953     END IF;
1954 
1955 
1956 	--ATTRIBUTE11
1957 
1958 		validate_attribute11(x_return_status, p_bclv_rec.attribute11);
1959 
1960     -- store the highest degree of error
1961     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1962         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1963         -- need to leave
1964         l_return_status := x_return_status;
1965         RAISE G_EXCEPTION_HALT_VALIDATION;
1966         ELSE
1967         -- record that there was an error
1968         l_return_status := x_return_status;
1969         END IF;
1970     END IF;
1971 
1972 
1973 	--ATTRIBUTE12
1974 
1975 		validate_attribute12(x_return_status, p_bclv_rec.attribute12);
1976 
1977     -- store the highest degree of error
1978     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1979         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1980         -- need to leave
1981         l_return_status := x_return_status;
1982         RAISE G_EXCEPTION_HALT_VALIDATION;
1983         ELSE
1984         -- record that there was an error
1985         l_return_status := x_return_status;
1986         END IF;
1987     END IF;
1988 
1989 
1990 	--ATTRIBUTE13
1991 		validate_attribute13(x_return_status, p_bclv_rec.attribute13);
1992 
1993     -- store the highest degree of error
1994     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1995         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1996         -- need to leave
1997         l_return_status := x_return_status;
1998         RAISE G_EXCEPTION_HALT_VALIDATION;
1999         ELSE
2000         -- record that there was an error
2001         l_return_status := x_return_status;
2002         END IF;
2003     END IF;
2004 
2005 
2006 	--ATTRIBUTE14
2007 
2008 		validate_attribute14(x_return_status, p_bclv_rec.attribute14);
2009 
2010     -- store the highest degree of error
2011     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2012         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2013         -- need to leave
2014         l_return_status := x_return_status;
2015         RAISE G_EXCEPTION_HALT_VALIDATION;
2016         ELSE
2017         -- record that there was an error
2018         l_return_status := x_return_status;
2019         END IF;
2020     END IF;
2021 
2022 	--ATTRIBUTE15
2023 
2024 		validate_attribute15(x_return_status, p_bclv_rec.attribute15);
2025 
2026     -- store the highest degree of error
2027     IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2028         IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2029         -- need to leave
2030         l_return_status := x_return_status;
2031         RAISE G_EXCEPTION_HALT_VALIDATION;
2032         ELSE
2033         -- record that there was an error
2034         l_return_status := x_return_status;
2035         END IF;
2036     END IF;
2037 
2038     Raise G_EXCEPTION_HALT_VALIDATION;
2039 
2040   Exception
2041 
2042   When G_EXCEPTION_HALT_VALIDATION Then
2043 
2044        Return (l_return_status);
2045 
2046   When OTHERS Then
2047        -- store SQL error message on message stack for caller
2048        OKC_API.SET_MESSAGE(p_app_name         => g_app_name,
2049                            p_msg_name         => g_unexpected_error,
2050                            p_token1           => g_sqlcode_token,
2051                            p_token1_value     => sqlcode,
2052                            p_token2           => g_sqlerrm_token,
2053                            p_token2_value     => sqlerrm);
2054 
2055        -- notify caller of an UNEXPECTED error
2056        l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2057        Return(l_return_status);
2058 
2059   END validate_attributes;
2060 
2061 
2062 
2063 /*
2064   ---------------------------------------------------
2065   -- Validate_Attributes for:OKS_BILL_CONT_LINES_V --
2066   ---------------------------------------------------
2067   FUNCTION Validate_Attributes (
2068     p_bclv_rec IN  bclv_rec_type
2069   ) RETURN VARCHAR2 IS
2070     l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2071   BEGIN
2072     IF p_bclv_rec.id = OKC_API.G_MISS_NUM OR
2073        p_bclv_rec.id IS NULL
2074     THEN
2075       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'id');
2076       l_return_status := OKC_API.G_RET_STS_ERROR;
2077     ELSIF p_bclv_rec.object_version_number = OKC_API.G_MISS_NUM OR
2078           p_bclv_rec.object_version_number IS NULL
2079     THEN
2080       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'object_version_number');
2081       l_return_status := OKC_API.G_RET_STS_ERROR;
2082     ELSIF p_bclv_rec.cle_id = OKC_API.G_MISS_NUM OR
2083           p_bclv_rec.cle_id IS NULL
2084     THEN
2085       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'cle_id');
2086       l_return_status := OKC_API.G_RET_STS_ERROR;
2087     ELSIF p_bclv_rec.date_billed_from = OKC_API.G_MISS_DATE OR
2088           p_bclv_rec.date_billed_from IS NULL
2089     THEN
2090       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'date_billed_from');
2091       l_return_status := OKC_API.G_RET_STS_ERROR;
2092     ELSIF p_bclv_rec.date_billed_to = OKC_API.G_MISS_DATE OR
2093           p_bclv_rec.date_billed_to IS NULL
2094     THEN
2095       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'date_billed_to');
2096       l_return_status := OKC_API.G_RET_STS_ERROR;
2097     ELSIF p_bclv_rec.sent_yn = OKC_API.G_MISS_CHAR OR
2098           p_bclv_rec.sent_yn IS NULL
2099     THEN
2100       OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'sent_yn');
2101       l_return_status := OKC_API.G_RET_STS_ERROR;
2102     END IF;
2103     RETURN(l_return_status);
2104   END Validate_Attributes;
2105 
2106   ---------------------------------------------------------------------------
2107   -- PROCEDURE Validate_Record
2108   ---------------------------------------------------------------------------
2109 */
2110   -----------------------------------------------
2111   -- Validate_Record for:OKS_BILL_CONT_LINES_V --
2112   -----------------------------------------------
2113   FUNCTION Validate_Record (
2114     p_bclv_rec IN bclv_rec_type
2115   ) RETURN VARCHAR2 IS
2116     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2117     ------------------------------------
2118     -- FUNCTION validate_foreign_keys --
2119     ------------------------------------
2120     FUNCTION validate_foreign_keys (
2121       p_bclv_rec IN bclv_rec_type
2122     ) RETURN VARCHAR2 IS
2123       item_not_found_error          EXCEPTION;
2124       CURSOR okc_btnv_pk_csr (p_id                 IN NUMBER) IS
2125       SELECT
2126               ID,
2127               OBJECT_VERSION_NUMBER,
2128               TRX_DATE,
2129               TRX_NUMBER,
2130               TRX_AMOUNT,
2131               TRX_CLASS,
2132               CURRENCY_CODE,
2133               CREATED_BY,
2134               CREATION_DATE,
2135               LAST_UPDATED_BY,
2136               LAST_UPDATE_DATE,
2137               LAST_UPDATE_LOGIN
2138         FROM Oks_Bill_Transactions_V
2139        WHERE oks_bill_transactions_v.id = p_id;
2140       l_okc_btnv_pk                  okc_btnv_pk_csr%ROWTYPE;
2141       CURSOR okc_clev_pk_csr (p_id                 IN NUMBER) IS
2142       SELECT
2143               ID,
2144               OBJECT_VERSION_NUMBER,
2145               SFWT_FLAG,
2146               CHR_ID,
2147               CLE_ID,
2148               LSE_ID,
2149               LINE_NUMBER,
2150               STS_CODE,
2151               DISPLAY_SEQUENCE,
2152               TRN_CODE,
2153               DNZ_CHR_ID,
2154               COMMENTS,
2155               ITEM_DESCRIPTION,
2156               HIDDEN_IND,
2157               PRICE_UNIT,
2158               PRICE_UNIT_PERCENT,
2159               PRICE_NEGOTIATED,
2160               PRICE_LEVEL_IND,
2161               INVOICE_LINE_LEVEL_IND,
2162               DPAS_RATING,
2163               BLOCK23TEXT,
2164               EXCEPTION_YN,
2165               TEMPLATE_USED,
2166               DATE_TERMINATED,
2167               NAME,
2168               START_DATE,
2169               END_DATE,
2170               ATTRIBUTE_CATEGORY,
2171               ATTRIBUTE1,
2172               ATTRIBUTE2,
2173               ATTRIBUTE3,
2174               ATTRIBUTE4,
2175               ATTRIBUTE5,
2176               ATTRIBUTE6,
2177               ATTRIBUTE7,
2178               ATTRIBUTE8,
2179               ATTRIBUTE9,
2180               ATTRIBUTE10,
2181               ATTRIBUTE11,
2182               ATTRIBUTE12,
2183               ATTRIBUTE13,
2184               ATTRIBUTE14,
2185               ATTRIBUTE15,
2186               CREATED_BY,
2187               CREATION_DATE,
2188               LAST_UPDATED_BY,
2189               LAST_UPDATE_DATE,
2190               PRICE_TYPE,
2191               --UOM_CODE,
2192               CURRENCY_CODE,
2193               LAST_UPDATE_LOGIN
2194         FROM Okc_K_Lines_V
2195        WHERE okc_k_lines_v.id     = p_id;
2196       l_okc_clev_pk                  okc_clev_pk_csr%ROWTYPE;
2197       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2198       l_row_notfound                 BOOLEAN := TRUE;
2199     BEGIN
2200       IF (p_bclv_rec.BTN_ID IS NOT NULL and p_bclv_rec.BTN_ID not in (-55,-44))
2201       THEN
2202         OPEN okc_btnv_pk_csr(p_bclv_rec.BTN_ID);
2203         FETCH okc_btnv_pk_csr INTO l_okc_btnv_pk;
2204         l_row_notfound := okc_btnv_pk_csr%NOTFOUND;
2205         CLOSE okc_btnv_pk_csr;
2206         IF (l_row_notfound) THEN
2207           OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'BTN_ID');
2208           RAISE item_not_found_error;
2209         END IF;
2210       END IF;
2211       IF (p_bclv_rec.CLE_ID IS NOT NULL)
2212       THEN
2213         OPEN okc_clev_pk_csr(p_bclv_rec.CLE_ID);
2214         FETCH okc_clev_pk_csr INTO l_okc_clev_pk;
2215         l_row_notfound := okc_clev_pk_csr%NOTFOUND;
2216         CLOSE okc_clev_pk_csr;
2217         IF (l_row_notfound) THEN
2218           OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'CLE_ID');
2219           RAISE item_not_found_error;
2220         END IF;
2221       END IF;
2222       RETURN (l_return_status);
2223     EXCEPTION
2224       WHEN item_not_found_error THEN
2225         l_return_status := OKC_API.G_RET_STS_ERROR;
2226         RETURN (l_return_status);
2227     END validate_foreign_keys;
2228   BEGIN
2229     l_return_status := validate_foreign_keys (p_bclv_rec);
2230     RETURN (l_return_status);
2231   END Validate_Record;
2232 
2233   ---------------------------------------------------------------------------
2234   -- PROCEDURE Migrate
2235   ---------------------------------------------------------------------------
2236   PROCEDURE migrate (
2237     p_from	IN bclv_rec_type,
2238     p_to	OUT NOCOPY bcl_rec_type
2239   ) IS
2240   BEGIN
2241     p_to.id := p_from.id;
2242     p_to.cle_id := p_from.cle_id;
2243     p_to.btn_id := p_from.btn_id;
2244     p_to.date_billed_from := p_from.date_billed_from;
2245     p_to.date_billed_to := p_from.date_billed_to;
2246     p_to.sent_yn := p_from.sent_yn;
2247     p_to.currency_code := p_from.currency_code;
2248     p_to.object_version_number := p_from.object_version_number;
2249     p_to.created_by := p_from.created_by;
2250     p_to.creation_date := p_from.creation_date;
2251     p_to.last_updated_by := p_from.last_updated_by;
2252     p_to.last_update_date := p_from.last_update_date;
2253     p_to.amount := p_from.amount;
2254     p_to.bill_action := p_from.bill_action;
2255     p_to.date_next_invoice := p_from.date_next_invoice;
2256     p_to.last_update_login := p_from.last_update_login;
2257     p_to.attribute_category := p_from.attribute_category;
2258     p_to.attribute1 := p_from.attribute1;
2259     p_to.attribute2 := p_from.attribute2;
2260     p_to.attribute3 := p_from.attribute3;
2261     p_to.attribute4 := p_from.attribute4;
2262     p_to.attribute5 := p_from.attribute5;
2263     p_to.attribute6 := p_from.attribute6;
2264     p_to.attribute7 := p_from.attribute7;
2265     p_to.attribute8 := p_from.attribute8;
2266     p_to.attribute9 := p_from.attribute9;
2267     p_to.attribute10 := p_from.attribute10;
2268     p_to.attribute11 := p_from.attribute11;
2269     p_to.attribute12 := p_from.attribute12;
2270     p_to.attribute13 := p_from.attribute13;
2271     p_to.attribute14 := p_from.attribute14;
2272     p_to.attribute15 := p_from.attribute15;
2273   END migrate;
2274   PROCEDURE migrate (
2275     p_from	IN bcl_rec_type,
2276     p_to	OUT NOCOPY bclv_rec_type
2277   ) IS
2278   BEGIN
2279     p_to.id := p_from.id;
2280     p_to.cle_id := p_from.cle_id;
2281     p_to.btn_id := p_from.btn_id;
2282     p_to.date_billed_from := p_from.date_billed_from;
2283     p_to.date_billed_to := p_from.date_billed_to;
2284     p_to.sent_yn := p_from.sent_yn;
2285     p_to.currency_code := p_from.currency_code;
2286     p_to.object_version_number := p_from.object_version_number;
2287     p_to.created_by := p_from.created_by;
2288     p_to.creation_date := p_from.creation_date;
2289     p_to.last_updated_by := p_from.last_updated_by;
2290     p_to.last_update_date := p_from.last_update_date;
2291     p_to.amount := p_from.amount;
2292     p_to.bill_action := p_from.bill_action;
2293     p_to.date_next_invoice := p_from.date_next_invoice;
2294     p_to.last_update_login := p_from.last_update_login;
2295     p_to.attribute_category := p_from.attribute_category;
2296     p_to.attribute1 := p_from.attribute1;
2297     p_to.attribute2 := p_from.attribute2;
2298     p_to.attribute3 := p_from.attribute3;
2299     p_to.attribute4 := p_from.attribute4;
2300     p_to.attribute5 := p_from.attribute5;
2301     p_to.attribute6 := p_from.attribute6;
2302     p_to.attribute7 := p_from.attribute7;
2303     p_to.attribute8 := p_from.attribute8;
2304     p_to.attribute9 := p_from.attribute9;
2305     p_to.attribute10 := p_from.attribute10;
2306     p_to.attribute11 := p_from.attribute11;
2307     p_to.attribute12 := p_from.attribute12;
2308     p_to.attribute13 := p_from.attribute13;
2309     p_to.attribute14 := p_from.attribute14;
2310     p_to.attribute15 := p_from.attribute15;
2311   END migrate;
2312 
2313   ---------------------------------------------------------------------------
2314   -- PROCEDURE validate_row
2315   ---------------------------------------------------------------------------
2316   --------------------------------------------
2317   -- validate_row for:OKS_BILL_CONT_LINES_V --
2318   --------------------------------------------
2319   PROCEDURE validate_row(
2320     p_api_version                  IN NUMBER,
2321     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2322     x_return_status                OUT NOCOPY VARCHAR2,
2323     x_msg_count                    OUT NOCOPY NUMBER,
2324     x_msg_data                     OUT NOCOPY VARCHAR2,
2325     p_bclv_rec                     IN bclv_rec_type) IS
2326 
2327     l_api_version                 CONSTANT NUMBER := 1;
2328     l_api_name                     CONSTANT VARCHAR2(30) := 'V_validate_row';
2329     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2330     l_bclv_rec                     bclv_rec_type := p_bclv_rec;
2331     l_bcl_rec                      bcl_rec_type;
2332   BEGIN
2333     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2334                                               G_PKG_NAME,
2335                                               p_init_msg_list,
2336                                               l_api_version,
2337                                               p_api_version,
2338                                               '_PVT',
2339                                               x_return_status);
2340     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2341       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2342     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2343       RAISE OKC_API.G_EXCEPTION_ERROR;
2344     END IF;
2345     --- Validate all non-missing attributes (Item Level Validation)
2346     l_return_status := Validate_Attributes(l_bclv_rec);
2347     --- If any errors happen abort API
2348     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2349       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2350     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2351       RAISE OKC_API.G_EXCEPTION_ERROR;
2352     END IF;
2353     l_return_status := Validate_Record(l_bclv_rec);
2354     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2355       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2356     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2357       RAISE OKC_API.G_EXCEPTION_ERROR;
2358     END IF;
2359     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2360   EXCEPTION
2361     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2362       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2363       (
2364         l_api_name,
2365         G_PKG_NAME,
2366         'OKC_API.G_RET_STS_ERROR',
2367         x_msg_count,
2368         x_msg_data,
2369         '_PVT'
2370       );
2371     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2372       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2373       (
2374         l_api_name,
2375         G_PKG_NAME,
2376         'OKC_API.G_RET_STS_UNEXP_ERROR',
2377         x_msg_count,
2378         x_msg_data,
2379         '_PVT'
2380       );
2381     WHEN OTHERS THEN
2382       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2383       (
2384         l_api_name,
2385         G_PKG_NAME,
2386         'OTHERS',
2387         x_msg_count,
2388         x_msg_data,
2389         '_PVT'
2390       );
2391   END validate_row;
2392   ------------------------------------------
2393   -- PL/SQL TBL validate_row for:BCLV_TBL --
2394   ------------------------------------------
2395   PROCEDURE validate_row(
2396     p_api_version                  IN NUMBER,
2397     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2398     x_return_status                OUT NOCOPY VARCHAR2,
2399     x_msg_count                    OUT NOCOPY NUMBER,
2400     x_msg_data                     OUT NOCOPY VARCHAR2,
2401     p_bclv_tbl                     IN bclv_tbl_type) IS
2402 
2403     l_api_version                 CONSTANT NUMBER := 1;
2404     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
2405     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2406     i                              NUMBER := 0;
2407   BEGIN
2408     OKC_API.init_msg_list(p_init_msg_list);
2409     -- Make sure PL/SQL table has records in it before passing
2410     IF (p_bclv_tbl.COUNT > 0) THEN
2411       i := p_bclv_tbl.FIRST;
2412       LOOP
2413         validate_row (
2414           p_api_version                  => p_api_version,
2415           p_init_msg_list                => OKC_API.G_FALSE,
2416           x_return_status                => x_return_status,
2417           x_msg_count                    => x_msg_count,
2418           x_msg_data                     => x_msg_data,
2419           p_bclv_rec                     => p_bclv_tbl(i));
2420         EXIT WHEN (i = p_bclv_tbl.LAST);
2421         i := p_bclv_tbl.NEXT(i);
2422       END LOOP;
2423     END IF;
2424   EXCEPTION
2425     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2426       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2427       (
2428         l_api_name,
2429         G_PKG_NAME,
2430         'OKC_API.G_RET_STS_ERROR',
2431         x_msg_count,
2432         x_msg_data,
2433         '_PVT'
2434       );
2435     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2436       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2437       (
2438         l_api_name,
2439         G_PKG_NAME,
2440         'OKC_API.G_RET_STS_UNEXP_ERROR',
2441         x_msg_count,
2442         x_msg_data,
2443         '_PVT'
2444       );
2445     WHEN OTHERS THEN
2446       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2447       (
2448         l_api_name,
2449         G_PKG_NAME,
2450         'OTHERS',
2451         x_msg_count,
2452         x_msg_data,
2453         '_PVT'
2454       );
2455   END validate_row;
2456 
2457   ---------------------------------------------------------------------------
2458   -- PROCEDURE insert_row
2459   ---------------------------------------------------------------------------
2460   ----------------------------------------
2461   -- insert_row for:OKS_BILL_CONT_LINES --
2462   ----------------------------------------
2463   PROCEDURE insert_row(
2464     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2465     x_return_status                OUT NOCOPY VARCHAR2,
2466     x_msg_count                    OUT NOCOPY NUMBER,
2467     x_msg_data                     OUT NOCOPY VARCHAR2,
2468     p_bcl_rec                      IN bcl_rec_type,
2469     x_bcl_rec                      OUT NOCOPY bcl_rec_type) IS
2470 
2471     l_api_version                 CONSTANT NUMBER := 1;
2472     l_api_name                     CONSTANT VARCHAR2(30) := 'LINES_insert_row';
2473     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2474     l_bcl_rec                      bcl_rec_type := p_bcl_rec;
2475     l_def_bcl_rec                  bcl_rec_type;
2476     --------------------------------------------
2477     -- Set_Attributes for:OKS_BILL_CONT_LINES --
2478     --------------------------------------------
2479     FUNCTION Set_Attributes (
2480       p_bcl_rec IN  bcl_rec_type,
2481       x_bcl_rec OUT NOCOPY bcl_rec_type
2482     ) RETURN VARCHAR2 IS
2483       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2484     BEGIN
2485       x_bcl_rec := p_bcl_rec;
2486       RETURN(l_return_status);
2487     END Set_Attributes;
2488   BEGIN
2489     FND_FILE.PUT_LINE( FND_FILE.LOG, 'inside insert bcl procedure');
2490 
2491     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2492                                               p_init_msg_list,
2493                                               '_PVT',
2494                                               x_return_status);
2495     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2496       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2497     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2498       RAISE OKC_API.G_EXCEPTION_ERROR;
2499     END IF;
2500 
2501     FND_FILE.PUT_LINE( FND_FILE.LOG, 'before setting item attributes');
2502 
2503     --- Setting item attributes
2504     l_return_status := Set_Attributes(
2505       p_bcl_rec,                         -- IN
2506       l_bcl_rec);                        -- OUT
2507     --- If any errors happen abort API
2508     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2509       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2510     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2511       RAISE OKC_API.G_EXCEPTION_ERROR;
2512     END IF;
2513 
2514 
2515     FND_FILE.PUT_LINE( FND_FILE.LOG, 'for id ' || l_bcl_rec.id ||'cle '|| l_bcl_rec.cle_id ||'btn '|| l_bcl_rec.btn_id);
2516     FND_FILE.PUT_LINE( FND_FILE.LOG, 'date from ' || l_bcl_rec.date_billed_from ||'To  '|| l_bcl_rec.date_billed_to);
2517     FND_FILE.PUT_LINE( FND_FILE.LOG, 'sent yn ' || l_bcl_rec.sent_yn ||'Cur  '|| l_bcl_rec.currency_code);
2518     FND_FILE.PUT_LINE( FND_FILE.LOG, 'ver ' || l_bcl_rec.object_version_number ||'cr by '|| l_bcl_rec.created_by);
2519     FND_FILE.PUT_LINE( FND_FILE.LOG, 'cr dt ' || l_bcl_rec.creation_date ||'up by '|| l_bcl_rec.last_updated_by);
2520     FND_FILE.PUT_LINE( FND_FILE.LOG, 'ls up dt ' || l_bcl_rec.last_update_date ||'Amt '||l_bcl_rec.amount);
2521     FND_FILE.PUT_LINE( FND_FILE.LOG, 'ls up lg ' || l_bcl_rec.last_update_login ||'At cg '||l_bcl_rec.attribute_category);
2522 
2523 
2524     INSERT INTO OKS_BILL_CONT_LINES(
2525         id,
2526         cle_id,
2527         btn_id,
2528         date_billed_from,
2529         date_billed_to,
2530         sent_yn,
2531         currency_code,
2532         object_version_number,
2533         created_by,
2534         creation_date,
2535         last_updated_by,
2536         last_update_date,
2537         amount,
2538         bill_action,
2539         date_next_invoice,
2540         last_update_login,
2541         attribute_category,
2542         attribute1,
2543         attribute2,
2544         attribute3,
2545         attribute4,
2546         attribute5,
2547         attribute6,
2548         attribute7,
2549         attribute8,
2550         attribute9,
2551         attribute10,
2552         attribute11,
2553         attribute12,
2554         attribute13,
2555         attribute14,
2556         attribute15)
2557       VALUES (
2558         l_bcl_rec.id,
2559         l_bcl_rec.cle_id,
2560         l_bcl_rec.btn_id,
2561         l_bcl_rec.date_billed_from,
2562         l_bcl_rec.date_billed_to,
2563         l_bcl_rec.sent_yn,
2564         l_bcl_rec.currency_code,
2565         l_bcl_rec.object_version_number,
2566         l_bcl_rec.created_by,
2567         l_bcl_rec.creation_date,
2568         l_bcl_rec.last_updated_by,
2569         l_bcl_rec.last_update_date,
2570         l_bcl_rec.amount,
2571         l_bcl_rec.bill_action,
2572         l_bcl_rec.date_next_invoice,
2573         l_bcl_rec.last_update_login,
2574         l_bcl_rec.attribute_category,
2575         l_bcl_rec.attribute1,
2576         l_bcl_rec.attribute2,
2577         l_bcl_rec.attribute3,
2578         l_bcl_rec.attribute4,
2579         l_bcl_rec.attribute5,
2580         l_bcl_rec.attribute6,
2581         l_bcl_rec.attribute7,
2582         l_bcl_rec.attribute8,
2583         l_bcl_rec.attribute9,
2584         l_bcl_rec.attribute10,
2585         l_bcl_rec.attribute11,
2586         l_bcl_rec.attribute12,
2587         l_bcl_rec.attribute13,
2588         l_bcl_rec.attribute14,
2589         l_bcl_rec.attribute15);
2590     -- Set OUT values
2591     x_bcl_rec := l_bcl_rec;
2592     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2593   EXCEPTION
2594     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2595       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2596       (
2597         l_api_name,
2598         G_PKG_NAME,
2599         'OKC_API.G_RET_STS_ERROR',
2600         x_msg_count,
2601         x_msg_data,
2602         '_PVT'
2603       );
2604     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2605       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2606       (
2607         l_api_name,
2608         G_PKG_NAME,
2609         'OKC_API.G_RET_STS_UNEXP_ERROR',
2610         x_msg_count,
2611         x_msg_data,
2612         '_PVT'
2613       );
2614     WHEN OTHERS THEN
2615       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2616       (
2617         l_api_name,
2618         G_PKG_NAME,
2619         'OTHERS',
2620         x_msg_count,
2621         x_msg_data,
2622         '_PVT'
2623       );
2624   END insert_row;
2625   ------------------------------------------
2626   -- insert_row for:OKS_BILL_CONT_LINES_V --
2627   ------------------------------------------
2628   PROCEDURE insert_row(
2629     p_api_version                  IN NUMBER,
2630     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2631     x_return_status                OUT NOCOPY VARCHAR2,
2632     x_msg_count                    OUT NOCOPY NUMBER,
2633     x_msg_data                     OUT NOCOPY VARCHAR2,
2634     p_bclv_rec                     IN bclv_rec_type,
2635     x_bclv_rec                     OUT NOCOPY bclv_rec_type) IS
2636 
2637     l_api_version                 CONSTANT NUMBER := 1;
2638     l_api_name                     CONSTANT VARCHAR2(30) := 'V_insert_row';
2639     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2640     l_bclv_rec                     bclv_rec_type;
2641     l_def_bclv_rec                 bclv_rec_type;
2642     l_bcl_rec                      bcl_rec_type;
2643     lx_bcl_rec                     bcl_rec_type;
2644     -------------------------------
2645     -- FUNCTION fill_who_columns --
2646     -------------------------------
2647     FUNCTION fill_who_columns (
2648       p_bclv_rec	IN bclv_rec_type
2649     ) RETURN bclv_rec_type IS
2650       l_bclv_rec	bclv_rec_type := p_bclv_rec;
2651     BEGIN
2652       l_bclv_rec.CREATION_DATE := SYSDATE;
2653       l_bclv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
2654       l_bclv_rec.LAST_UPDATE_DATE := SYSDATE;
2655       l_bclv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
2656       l_bclv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
2657       RETURN(l_bclv_rec);
2658     END fill_who_columns;
2659     ----------------------------------------------
2660     -- Set_Attributes for:OKS_BILL_CONT_LINES_V --
2661     ----------------------------------------------
2662     FUNCTION Set_Attributes (
2663       p_bclv_rec IN  bclv_rec_type,
2664       x_bclv_rec OUT NOCOPY bclv_rec_type
2665     ) RETURN VARCHAR2 IS
2666       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2667     BEGIN
2668       x_bclv_rec := p_bclv_rec;
2669       x_bclv_rec.OBJECT_VERSION_NUMBER := 1;
2670       RETURN(l_return_status);
2671     END Set_Attributes;
2672   BEGIN
2673     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2674                                               G_PKG_NAME,
2675                                               p_init_msg_list,
2676                                               l_api_version,
2677                                               p_api_version,
2678                                               '_PVT',
2679                                               x_return_status);
2680     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2681       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2682     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2683       RAISE OKC_API.G_EXCEPTION_ERROR;
2684     END IF;
2685     l_bclv_rec := null_out_defaults(p_bclv_rec);
2686     -- Set primary key value
2687     l_bclv_rec.ID := get_seq_id;
2688     --- Setting item attributes
2689     l_return_status := Set_Attributes(
2690       l_bclv_rec,                        -- IN
2691       l_def_bclv_rec);                   -- OUT
2692     --- If any errors happen abort API
2693     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2694       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2695     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2696       RAISE OKC_API.G_EXCEPTION_ERROR;
2697     END IF;
2698     l_def_bclv_rec := fill_who_columns(l_def_bclv_rec);
2699     --- Validate all non-missing attributes (Item Level Validation)
2700     l_return_status := Validate_Attributes(l_def_bclv_rec);
2701     --- If any errors happen abort API
2702     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2703       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2704     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2705       RAISE OKC_API.G_EXCEPTION_ERROR;
2706     END IF;
2707     l_return_status := Validate_Record(l_def_bclv_rec);
2708     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2709       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2710     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2711       RAISE OKC_API.G_EXCEPTION_ERROR;
2712     END IF;
2713     --------------------------------------
2714     -- Move VIEW record to "Child" records
2715     --------------------------------------
2716     migrate(l_def_bclv_rec, l_bcl_rec);
2717     --------------------------------------------
2718     -- Call the INSERT_ROW for each child record
2719     --------------------------------------------
2720     insert_row(
2721       p_init_msg_list,
2722       x_return_status,
2723       x_msg_count,
2724       x_msg_data,
2725       l_bcl_rec,
2726       lx_bcl_rec
2727     );
2728     IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2729       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2730     ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2731       RAISE OKC_API.G_EXCEPTION_ERROR;
2732     END IF;
2733     migrate(lx_bcl_rec, l_def_bclv_rec);
2734     -- Set OUT values
2735     x_bclv_rec := l_def_bclv_rec;
2736     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2737   EXCEPTION
2738     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2739       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2740       (
2741         l_api_name,
2742         G_PKG_NAME,
2743         'OKC_API.G_RET_STS_ERROR',
2744         x_msg_count,
2745         x_msg_data,
2746         '_PVT'
2747       );
2748     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2749       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2750       (
2751         l_api_name,
2752         G_PKG_NAME,
2753         'OKC_API.G_RET_STS_UNEXP_ERROR',
2754         x_msg_count,
2755         x_msg_data,
2756         '_PVT'
2757       );
2758     WHEN OTHERS THEN
2759       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2760       (
2761         l_api_name,
2762         G_PKG_NAME,
2763         'OTHERS',
2764         x_msg_count,
2765         x_msg_data,
2766         '_PVT'
2767       );
2768   END insert_row;
2769   ----------------------------------------
2770   -- PL/SQL TBL insert_row for:BCLV_TBL --
2771   ----------------------------------------
2772   PROCEDURE insert_row(
2773     p_api_version                  IN NUMBER,
2774     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2775     x_return_status                OUT NOCOPY VARCHAR2,
2776     x_msg_count                    OUT NOCOPY NUMBER,
2777     x_msg_data                     OUT NOCOPY VARCHAR2,
2778     p_bclv_tbl                     IN bclv_tbl_type,
2779     x_bclv_tbl                     OUT NOCOPY bclv_tbl_type) IS
2780 
2781     l_api_version                 CONSTANT NUMBER := 1;
2782     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
2783     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2784     i                              NUMBER := 0;
2785   BEGIN
2786     OKC_API.init_msg_list(p_init_msg_list);
2787     -- Make sure PL/SQL table has records in it before passing
2788     IF (p_bclv_tbl.COUNT > 0) THEN
2789       i := p_bclv_tbl.FIRST;
2790       LOOP
2791         insert_row (
2792           p_api_version                  => p_api_version,
2793           p_init_msg_list                => OKC_API.G_FALSE,
2794           x_return_status                => x_return_status,
2795           x_msg_count                    => x_msg_count,
2796           x_msg_data                     => x_msg_data,
2797           p_bclv_rec                     => p_bclv_tbl(i),
2798           x_bclv_rec                     => x_bclv_tbl(i));
2799         EXIT WHEN (i = p_bclv_tbl.LAST);
2800         i := p_bclv_tbl.NEXT(i);
2801       END LOOP;
2802     END IF;
2803   EXCEPTION
2804     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2805       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2806       (
2807         l_api_name,
2808         G_PKG_NAME,
2809         'OKC_API.G_RET_STS_ERROR',
2810         x_msg_count,
2811         x_msg_data,
2812         '_PVT'
2813       );
2814     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2815       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2816       (
2817         l_api_name,
2818         G_PKG_NAME,
2819         'OKC_API.G_RET_STS_UNEXP_ERROR',
2820         x_msg_count,
2821         x_msg_data,
2822         '_PVT'
2823       );
2824     WHEN OTHERS THEN
2825       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2826       (
2827         l_api_name,
2828         G_PKG_NAME,
2829         'OTHERS',
2830         x_msg_count,
2831         x_msg_data,
2832         '_PVT'
2833       );
2834   END insert_row;
2835 
2836   ---------------------------------------------------------------------------
2837   -- PROCEDURE lock_row
2838   ---------------------------------------------------------------------------
2839   --------------------------------------
2840   -- lock_row for:OKS_BILL_CONT_LINES --
2841   --------------------------------------
2842   PROCEDURE lock_row(
2843     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2844     x_return_status                OUT NOCOPY VARCHAR2,
2845     x_msg_count                    OUT NOCOPY NUMBER,
2846     x_msg_data                     OUT NOCOPY VARCHAR2,
2847     p_bcl_rec                      IN bcl_rec_type) IS
2848 
2849     E_Resource_Busy               EXCEPTION;
2850     PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
2851     CURSOR lock_csr (p_bcl_rec IN bcl_rec_type) IS
2852     SELECT OBJECT_VERSION_NUMBER
2853       FROM OKS_BILL_CONT_LINES
2854      WHERE ID = p_bcl_rec.id
2855        AND OBJECT_VERSION_NUMBER = p_bcl_rec.object_version_number
2856     FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
2857 
2858     CURSOR  lchk_csr (p_bcl_rec IN bcl_rec_type) IS
2859     SELECT OBJECT_VERSION_NUMBER
2860       FROM OKS_BILL_CONT_LINES
2861     WHERE ID = p_bcl_rec.id;
2862     l_api_version                 CONSTANT NUMBER := 1;
2863     l_api_name                     CONSTANT VARCHAR2(30) := 'LINES_lock_row';
2864     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2865     l_object_version_number       OKS_BILL_CONT_LINES.OBJECT_VERSION_NUMBER%TYPE;
2866     lc_object_version_number      OKS_BILL_CONT_LINES.OBJECT_VERSION_NUMBER%TYPE;
2867     l_row_notfound                BOOLEAN := FALSE;
2868     lc_row_notfound               BOOLEAN := FALSE;
2869   BEGIN
2870     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2871                                               p_init_msg_list,
2872                                               '_PVT',
2873                                               x_return_status);
2874     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2875       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2876     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2877       RAISE OKC_API.G_EXCEPTION_ERROR;
2878     END IF;
2879     BEGIN
2880       OPEN lock_csr(p_bcl_rec);
2881       FETCH lock_csr INTO l_object_version_number;
2882       l_row_notfound := lock_csr%NOTFOUND;
2883       CLOSE lock_csr;
2884     EXCEPTION
2885       WHEN E_Resource_Busy THEN
2886         IF (lock_csr%ISOPEN) THEN
2887           CLOSE lock_csr;
2888         END IF;
2889         OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2890         RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2891     END;
2892 
2893     IF ( l_row_notfound ) THEN
2894       OPEN lchk_csr(p_bcl_rec);
2895       FETCH lchk_csr INTO lc_object_version_number;
2896       lc_row_notfound := lchk_csr%NOTFOUND;
2897       CLOSE lchk_csr;
2898     END IF;
2899     IF (lc_row_notfound) THEN
2900       OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2901       RAISE OKC_API.G_EXCEPTION_ERROR;
2902     ELSIF lc_object_version_number > p_bcl_rec.object_version_number THEN
2903       OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2904       RAISE OKC_API.G_EXCEPTION_ERROR;
2905     ELSIF lc_object_version_number <> p_bcl_rec.object_version_number THEN
2906       OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2907       RAISE OKC_API.G_EXCEPTION_ERROR;
2908     ELSIF lc_object_version_number = -1 THEN
2909       OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
2910       RAISE OKC_API.G_EXCEPTION_ERROR;
2911     END IF;
2912     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2913   EXCEPTION
2914     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2915       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2916       (
2917         l_api_name,
2918         G_PKG_NAME,
2919         'OKC_API.G_RET_STS_ERROR',
2920         x_msg_count,
2921         x_msg_data,
2922         '_PVT'
2923       );
2924     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2925       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2926       (
2927         l_api_name,
2928         G_PKG_NAME,
2929         'OKC_API.G_RET_STS_UNEXP_ERROR',
2930         x_msg_count,
2931         x_msg_data,
2932         '_PVT'
2933       );
2934     WHEN OTHERS THEN
2935       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2936       (
2937         l_api_name,
2938         G_PKG_NAME,
2939         'OTHERS',
2940         x_msg_count,
2941         x_msg_data,
2942         '_PVT'
2943       );
2944   END lock_row;
2945   ----------------------------------------
2946   -- lock_row for:OKS_BILL_CONT_LINES_V --
2947   ----------------------------------------
2948   PROCEDURE lock_row(
2949     p_api_version                  IN NUMBER,
2950     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2951     x_return_status                OUT NOCOPY VARCHAR2,
2952     x_msg_count                    OUT NOCOPY NUMBER,
2953     x_msg_data                     OUT NOCOPY VARCHAR2,
2954     p_bclv_rec                     IN bclv_rec_type) IS
2955 
2956     l_api_version                 CONSTANT NUMBER := 1;
2957     l_api_name                     CONSTANT VARCHAR2(30) := 'V_lock_row';
2958     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2959     l_bcl_rec                      bcl_rec_type;
2960   BEGIN
2961     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2962                                               G_PKG_NAME,
2963                                               p_init_msg_list,
2964                                               l_api_version,
2965                                               p_api_version,
2966                                               '_PVT',
2967                                               x_return_status);
2968     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2969       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2970     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2971       RAISE OKC_API.G_EXCEPTION_ERROR;
2972     END IF;
2973     --------------------------------------
2974     -- Move VIEW record to "Child" records
2975     --------------------------------------
2976     migrate(p_bclv_rec, l_bcl_rec);
2977     --------------------------------------------
2978     -- Call the LOCK_ROW for each child record
2979     --------------------------------------------
2980     lock_row(
2981       p_init_msg_list,
2982       x_return_status,
2983       x_msg_count,
2984       x_msg_data,
2985       l_bcl_rec
2986     );
2987     IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2988       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2989     ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2990       RAISE OKC_API.G_EXCEPTION_ERROR;
2991     END IF;
2992     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2993   EXCEPTION
2994     WHEN OKC_API.G_EXCEPTION_ERROR THEN
2995       x_return_status := OKC_API.HANDLE_EXCEPTIONS
2996       (
2997         l_api_name,
2998         G_PKG_NAME,
2999         'OKC_API.G_RET_STS_ERROR',
3000         x_msg_count,
3001         x_msg_data,
3002         '_PVT'
3003       );
3004     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3005       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3006       (
3007         l_api_name,
3008         G_PKG_NAME,
3009         'OKC_API.G_RET_STS_UNEXP_ERROR',
3010         x_msg_count,
3011         x_msg_data,
3012         '_PVT'
3013       );
3014     WHEN OTHERS THEN
3015       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3016       (
3017         l_api_name,
3018         G_PKG_NAME,
3019         'OTHERS',
3020         x_msg_count,
3021         x_msg_data,
3022         '_PVT'
3023       );
3024   END lock_row;
3025   --------------------------------------
3026   -- PL/SQL TBL lock_row for:BCLV_TBL --
3027   --------------------------------------
3028   PROCEDURE lock_row(
3029     p_api_version                  IN NUMBER,
3030     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3031     x_return_status                OUT NOCOPY VARCHAR2,
3032     x_msg_count                    OUT NOCOPY NUMBER,
3033     x_msg_data                     OUT NOCOPY VARCHAR2,
3034     p_bclv_tbl                     IN bclv_tbl_type) IS
3035 
3036     l_api_version                 CONSTANT NUMBER := 1;
3037     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
3038     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3039     i                              NUMBER := 0;
3040   BEGIN
3041     OKC_API.init_msg_list(p_init_msg_list);
3042     -- Make sure PL/SQL table has records in it before passing
3043     IF (p_bclv_tbl.COUNT > 0) THEN
3044       i := p_bclv_tbl.FIRST;
3045       LOOP
3046         lock_row (
3047           p_api_version                  => p_api_version,
3048           p_init_msg_list                => OKC_API.G_FALSE,
3049           x_return_status                => x_return_status,
3050           x_msg_count                    => x_msg_count,
3051           x_msg_data                     => x_msg_data,
3052           p_bclv_rec                     => p_bclv_tbl(i));
3053         EXIT WHEN (i = p_bclv_tbl.LAST);
3054         i := p_bclv_tbl.NEXT(i);
3055       END LOOP;
3056     END IF;
3057   EXCEPTION
3058     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3059       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3060       (
3061         l_api_name,
3062         G_PKG_NAME,
3063         'OKC_API.G_RET_STS_ERROR',
3064         x_msg_count,
3065         x_msg_data,
3066         '_PVT'
3067       );
3068     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3069       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3070       (
3071         l_api_name,
3072         G_PKG_NAME,
3073         'OKC_API.G_RET_STS_UNEXP_ERROR',
3074         x_msg_count,
3075         x_msg_data,
3076         '_PVT'
3077       );
3078     WHEN OTHERS THEN
3079       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3080       (
3081         l_api_name,
3082         G_PKG_NAME,
3083         'OTHERS',
3084         x_msg_count,
3085         x_msg_data,
3086         '_PVT'
3087       );
3088   END lock_row;
3089 
3090   ---------------------------------------------------------------------------
3091   -- PROCEDURE update_row
3092   ---------------------------------------------------------------------------
3093   ----------------------------------------
3094   -- update_row for:OKS_BILL_CONT_LINES --
3095   ----------------------------------------
3096   PROCEDURE update_row(
3097     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3098     x_return_status                OUT NOCOPY VARCHAR2,
3099     x_msg_count                    OUT NOCOPY NUMBER,
3100     x_msg_data                     OUT NOCOPY VARCHAR2,
3101     p_bcl_rec                      IN bcl_rec_type,
3102     x_bcl_rec                      OUT NOCOPY bcl_rec_type) IS
3103 
3104     l_api_version                 CONSTANT NUMBER := 1;
3105     l_api_name                     CONSTANT VARCHAR2(30) := 'LINES_update_row';
3106     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3107     l_bcl_rec                      bcl_rec_type := p_bcl_rec;
3108     l_def_bcl_rec                  bcl_rec_type;
3109     l_row_notfound                 BOOLEAN := TRUE;
3110     ----------------------------------
3111     -- FUNCTION populate_new_record --
3112     ----------------------------------
3113     FUNCTION populate_new_record (
3114       p_bcl_rec	IN bcl_rec_type,
3115       x_bcl_rec	OUT NOCOPY bcl_rec_type
3116     ) RETURN VARCHAR2 IS
3117       l_bcl_rec                      bcl_rec_type;
3118       l_row_notfound                 BOOLEAN := TRUE;
3119       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3120     BEGIN
3121       x_bcl_rec := p_bcl_rec;
3122       -- Get current database values
3123       l_bcl_rec := get_rec(p_bcl_rec, l_row_notfound);
3124       IF (l_row_notfound) THEN
3125         l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
3126       END IF;
3127       IF (x_bcl_rec.id = OKC_API.G_MISS_NUM)
3128       THEN
3129         x_bcl_rec.id := l_bcl_rec.id;
3130       END IF;
3131       IF (x_bcl_rec.cle_id = OKC_API.G_MISS_NUM)
3132       THEN
3133         x_bcl_rec.cle_id := l_bcl_rec.cle_id;
3134       END IF;
3135       IF (x_bcl_rec.btn_id = OKC_API.G_MISS_NUM)
3136       THEN
3137         x_bcl_rec.btn_id := l_bcl_rec.btn_id;
3138       END IF;
3139       IF (x_bcl_rec.date_billed_from = OKC_API.G_MISS_DATE)
3140       THEN
3141         x_bcl_rec.date_billed_from := l_bcl_rec.date_billed_from;
3142       END IF;
3143       IF (x_bcl_rec.date_billed_to = OKC_API.G_MISS_DATE)
3144       THEN
3145         x_bcl_rec.date_billed_to := l_bcl_rec.date_billed_to;
3146       END IF;
3147       IF (x_bcl_rec.sent_yn = OKC_API.G_MISS_CHAR)
3148       THEN
3149         x_bcl_rec.sent_yn := l_bcl_rec.sent_yn;
3150       END IF;
3151       IF (x_bcl_rec.currency_code = OKC_API.G_MISS_CHAR)
3152       THEN
3153         x_bcl_rec.currency_code := l_bcl_rec.currency_code;
3154       END IF;
3155       IF (x_bcl_rec.object_version_number = OKC_API.G_MISS_NUM)
3156       THEN
3157         x_bcl_rec.object_version_number := l_bcl_rec.object_version_number;
3158       END IF;
3159       IF (x_bcl_rec.created_by = OKC_API.G_MISS_NUM)
3160       THEN
3161         x_bcl_rec.created_by := l_bcl_rec.created_by;
3162       END IF;
3163       IF (x_bcl_rec.creation_date = OKC_API.G_MISS_DATE)
3164       THEN
3165         x_bcl_rec.creation_date := l_bcl_rec.creation_date;
3166       END IF;
3167       IF (x_bcl_rec.last_updated_by = OKC_API.G_MISS_NUM)
3168       THEN
3169         x_bcl_rec.last_updated_by := l_bcl_rec.last_updated_by;
3170       END IF;
3171       IF (x_bcl_rec.last_update_date = OKC_API.G_MISS_DATE)
3172       THEN
3173         x_bcl_rec.last_update_date := l_bcl_rec.last_update_date;
3174       END IF;
3175       IF (x_bcl_rec.amount = OKC_API.G_MISS_NUM)
3176       THEN
3177         x_bcl_rec.amount := l_bcl_rec.amount;
3178       END IF;
3179       IF (x_bcl_rec.bill_action = OKC_API.G_MISS_CHAR)
3180       THEN
3181         x_bcl_rec.bill_action := l_bcl_rec.bill_action;
3182       END IF;
3183       IF (x_bcl_rec.date_next_invoice = OKC_API.G_MISS_DATE)
3184       THEN
3185         x_bcl_rec.date_next_invoice := l_bcl_rec.date_next_invoice;
3186       END IF;
3187       IF (x_bcl_rec.last_update_login = OKC_API.G_MISS_NUM)
3188       THEN
3189         x_bcl_rec.last_update_login := l_bcl_rec.last_update_login;
3190       END IF;
3191       IF (x_bcl_rec.attribute_category = OKC_API.G_MISS_CHAR)
3192       THEN
3193         x_bcl_rec.attribute_category := l_bcl_rec.attribute_category;
3194       END IF;
3195       IF (x_bcl_rec.attribute1 = OKC_API.G_MISS_CHAR)
3196       THEN
3197         x_bcl_rec.attribute1 := l_bcl_rec.attribute1;
3198       END IF;
3199       IF (x_bcl_rec.attribute2 = OKC_API.G_MISS_CHAR)
3200       THEN
3201         x_bcl_rec.attribute2 := l_bcl_rec.attribute2;
3202       END IF;
3203       IF (x_bcl_rec.attribute3 = OKC_API.G_MISS_CHAR)
3204       THEN
3205         x_bcl_rec.attribute3 := l_bcl_rec.attribute3;
3206       END IF;
3207       IF (x_bcl_rec.attribute4 = OKC_API.G_MISS_CHAR)
3208       THEN
3209         x_bcl_rec.attribute4 := l_bcl_rec.attribute4;
3210       END IF;
3211       IF (x_bcl_rec.attribute5 = OKC_API.G_MISS_CHAR)
3212       THEN
3213         x_bcl_rec.attribute5 := l_bcl_rec.attribute5;
3214       END IF;
3215       IF (x_bcl_rec.attribute6 = OKC_API.G_MISS_CHAR)
3216       THEN
3217         x_bcl_rec.attribute6 := l_bcl_rec.attribute6;
3218       END IF;
3219       IF (x_bcl_rec.attribute7 = OKC_API.G_MISS_CHAR)
3220       THEN
3221         x_bcl_rec.attribute7 := l_bcl_rec.attribute7;
3222       END IF;
3223       IF (x_bcl_rec.attribute8 = OKC_API.G_MISS_CHAR)
3224       THEN
3225         x_bcl_rec.attribute8 := l_bcl_rec.attribute8;
3226       END IF;
3227       IF (x_bcl_rec.attribute9 = OKC_API.G_MISS_CHAR)
3228       THEN
3229         x_bcl_rec.attribute9 := l_bcl_rec.attribute9;
3230       END IF;
3231       IF (x_bcl_rec.attribute10 = OKC_API.G_MISS_CHAR)
3232       THEN
3233         x_bcl_rec.attribute10 := l_bcl_rec.attribute10;
3234       END IF;
3235       IF (x_bcl_rec.attribute11 = OKC_API.G_MISS_CHAR)
3236       THEN
3237         x_bcl_rec.attribute11 := l_bcl_rec.attribute11;
3238       END IF;
3239       IF (x_bcl_rec.attribute12 = OKC_API.G_MISS_CHAR)
3240       THEN
3241         x_bcl_rec.attribute12 := l_bcl_rec.attribute12;
3242       END IF;
3243       IF (x_bcl_rec.attribute13 = OKC_API.G_MISS_CHAR)
3244       THEN
3245         x_bcl_rec.attribute13 := l_bcl_rec.attribute13;
3246       END IF;
3247       IF (x_bcl_rec.attribute14 = OKC_API.G_MISS_CHAR)
3248       THEN
3249         x_bcl_rec.attribute14 := l_bcl_rec.attribute14;
3250       END IF;
3251       IF (x_bcl_rec.attribute15 = OKC_API.G_MISS_CHAR)
3252       THEN
3253         x_bcl_rec.attribute15 := l_bcl_rec.attribute15;
3254       END IF;
3255       RETURN(l_return_status);
3256     END populate_new_record;
3257     --------------------------------------------
3258     -- Set_Attributes for:OKS_BILL_CONT_LINES --
3259     --------------------------------------------
3260     FUNCTION Set_Attributes (
3261       p_bcl_rec IN  bcl_rec_type,
3262       x_bcl_rec OUT NOCOPY bcl_rec_type
3263     ) RETURN VARCHAR2 IS
3264       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3265     BEGIN
3266       x_bcl_rec := p_bcl_rec;
3267       RETURN(l_return_status);
3268     END Set_Attributes;
3269   BEGIN
3270     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3271                                               p_init_msg_list,
3272                                               '_PVT',
3273                                               x_return_status);
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     --- Setting item attributes
3280     l_return_status := Set_Attributes(
3281       p_bcl_rec,                         -- IN
3282       l_bcl_rec);                        -- OUT
3283     --- If any errors happen abort API
3284     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3285       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3286     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3287       RAISE OKC_API.G_EXCEPTION_ERROR;
3288     END IF;
3289     l_return_status := populate_new_record(l_bcl_rec, l_def_bcl_rec);
3290     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3291       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3292     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3293       RAISE OKC_API.G_EXCEPTION_ERROR;
3294     END IF;
3295     UPDATE  OKS_BILL_CONT_LINES
3296     SET CLE_ID = l_def_bcl_rec.cle_id,
3297         BTN_ID = l_def_bcl_rec.btn_id,
3298         DATE_BILLED_FROM = l_def_bcl_rec.date_billed_from,
3299         DATE_BILLED_TO = l_def_bcl_rec.date_billed_to,
3300         SENT_YN = l_def_bcl_rec.sent_yn,
3301         CURRENCY_CODE = l_def_bcl_rec.currency_code,
3302         OBJECT_VERSION_NUMBER = l_def_bcl_rec.object_version_number,
3303         CREATED_BY = l_def_bcl_rec.created_by,
3304         CREATION_DATE = l_def_bcl_rec.creation_date,
3305         LAST_UPDATED_BY = l_def_bcl_rec.last_updated_by,
3306         LAST_UPDATE_DATE = l_def_bcl_rec.last_update_date,
3307         AMOUNT = l_def_bcl_rec.amount,
3308         BILL_ACTION = l_def_bcl_rec.bill_action,
3309         DATE_NEXT_INVOICE = l_def_bcl_rec.date_next_invoice,
3310         LAST_UPDATE_LOGIN = l_def_bcl_rec.last_update_login,
3311         ATTRIBUTE_CATEGORY = l_def_bcl_rec.attribute_category,
3312         ATTRIBUTE1 = l_def_bcl_rec.attribute1,
3313         ATTRIBUTE2 = l_def_bcl_rec.attribute2,
3314         ATTRIBUTE3 = l_def_bcl_rec.attribute3,
3315         ATTRIBUTE4 = l_def_bcl_rec.attribute4,
3316         ATTRIBUTE5 = l_def_bcl_rec.attribute5,
3317         ATTRIBUTE6 = l_def_bcl_rec.attribute6,
3318         ATTRIBUTE7 = l_def_bcl_rec.attribute7,
3319         ATTRIBUTE8 = l_def_bcl_rec.attribute8,
3320         ATTRIBUTE9 = l_def_bcl_rec.attribute9,
3321         ATTRIBUTE10 = l_def_bcl_rec.attribute10,
3322         ATTRIBUTE11 = l_def_bcl_rec.attribute11,
3323         ATTRIBUTE12 = l_def_bcl_rec.attribute12,
3324         ATTRIBUTE13 = l_def_bcl_rec.attribute13,
3325         ATTRIBUTE14 = l_def_bcl_rec.attribute14,
3326         ATTRIBUTE15 = l_def_bcl_rec.attribute15
3327     WHERE ID = l_def_bcl_rec.id;
3328 
3329     x_bcl_rec := l_def_bcl_rec;
3330     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3331   EXCEPTION
3332     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3333       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3334       (
3335         l_api_name,
3336         G_PKG_NAME,
3337         'OKC_API.G_RET_STS_ERROR',
3338         x_msg_count,
3339         x_msg_data,
3340         '_PVT'
3341       );
3342     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3343       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3344       (
3345         l_api_name,
3346         G_PKG_NAME,
3347         'OKC_API.G_RET_STS_UNEXP_ERROR',
3348         x_msg_count,
3349         x_msg_data,
3350         '_PVT'
3351       );
3352     WHEN OTHERS THEN
3353       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3354       (
3355         l_api_name,
3356         G_PKG_NAME,
3357         'OTHERS',
3358         x_msg_count,
3359         x_msg_data,
3360         '_PVT'
3361       );
3362   END update_row;
3363   ------------------------------------------
3364   -- update_row for:OKS_BILL_CONT_LINES_V --
3365   ------------------------------------------
3366   PROCEDURE update_row(
3367     p_api_version                  IN NUMBER,
3368     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3369     x_return_status                OUT NOCOPY VARCHAR2,
3370     x_msg_count                    OUT NOCOPY NUMBER,
3371     x_msg_data                     OUT NOCOPY VARCHAR2,
3372     p_bclv_rec                     IN bclv_rec_type,
3373     x_bclv_rec                     OUT NOCOPY bclv_rec_type) IS
3374 
3375     l_api_version                 CONSTANT NUMBER := 1;
3376     l_api_name                     CONSTANT VARCHAR2(30) := 'V_update_row';
3377     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3378     l_bclv_rec                     bclv_rec_type := p_bclv_rec;
3379     l_def_bclv_rec                 bclv_rec_type;
3380     l_bcl_rec                      bcl_rec_type;
3381     lx_bcl_rec                     bcl_rec_type;
3382     -------------------------------
3383     -- FUNCTION fill_who_columns --
3384     -------------------------------
3385     FUNCTION fill_who_columns (
3386       p_bclv_rec	IN bclv_rec_type
3387     ) RETURN bclv_rec_type IS
3388       l_bclv_rec	bclv_rec_type := p_bclv_rec;
3389     BEGIN
3390       l_bclv_rec.LAST_UPDATE_DATE := SYSDATE;
3391       l_bclv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
3392       l_bclv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
3393       RETURN(l_bclv_rec);
3394     END fill_who_columns;
3395     ----------------------------------
3396     -- FUNCTION populate_new_record --
3397     ----------------------------------
3398     FUNCTION populate_new_record (
3399       p_bclv_rec	IN bclv_rec_type,
3400       x_bclv_rec	OUT NOCOPY bclv_rec_type
3401     ) RETURN VARCHAR2 IS
3402       l_bclv_rec                     bclv_rec_type;
3403       l_row_notfound                 BOOLEAN := TRUE;
3404       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3405     BEGIN
3406       x_bclv_rec := p_bclv_rec;
3407       -- Get current database values
3408       l_bclv_rec := get_rec(p_bclv_rec, l_row_notfound);
3409       IF (l_row_notfound) THEN
3410         l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
3411       END IF;
3412       IF (x_bclv_rec.id = OKC_API.G_MISS_NUM)
3413       THEN
3414         x_bclv_rec.id := l_bclv_rec.id;
3415       END IF;
3416       IF (x_bclv_rec.object_version_number = OKC_API.G_MISS_NUM)
3417       THEN
3418         x_bclv_rec.object_version_number := l_bclv_rec.object_version_number;
3419       END IF;
3420       IF (x_bclv_rec.cle_id = OKC_API.G_MISS_NUM)
3421       THEN
3422         x_bclv_rec.cle_id := l_bclv_rec.cle_id;
3423       END IF;
3424       IF (x_bclv_rec.btn_id = OKC_API.G_MISS_NUM)
3425       THEN
3426         x_bclv_rec.btn_id := l_bclv_rec.btn_id;
3427       END IF;
3428       IF (x_bclv_rec.date_billed_from = OKC_API.G_MISS_DATE)
3429       THEN
3430         x_bclv_rec.date_billed_from := l_bclv_rec.date_billed_from;
3431       END IF;
3432       IF (x_bclv_rec.date_billed_to = OKC_API.G_MISS_DATE)
3433       THEN
3434         x_bclv_rec.date_billed_to := l_bclv_rec.date_billed_to;
3435       END IF;
3436       IF (x_bclv_rec.date_next_invoice = OKC_API.G_MISS_DATE)
3437       THEN
3438         x_bclv_rec.date_next_invoice := l_bclv_rec.date_next_invoice;
3439       END IF;
3440       IF (x_bclv_rec.amount = OKC_API.G_MISS_NUM)
3441       THEN
3442         x_bclv_rec.amount := l_bclv_rec.amount;
3443       END IF;
3444       IF (x_bclv_rec.sent_yn = OKC_API.G_MISS_CHAR)
3445       THEN
3446         x_bclv_rec.sent_yn := l_bclv_rec.sent_yn;
3447       END IF;
3448       IF (x_bclv_rec.currency_code = OKC_API.G_MISS_CHAR)
3449       THEN
3450         x_bclv_rec.currency_code := l_bclv_rec.currency_code;
3451       END IF;
3452       IF (x_bclv_rec.bill_action = OKC_API.G_MISS_CHAR)
3453       THEN
3454         x_bclv_rec.bill_action := l_bclv_rec.bill_action;
3455       END IF;
3456       IF (x_bclv_rec.attribute_category = OKC_API.G_MISS_CHAR)
3457       THEN
3458         x_bclv_rec.attribute_category := l_bclv_rec.attribute_category;
3459       END IF;
3460       IF (x_bclv_rec.attribute1 = OKC_API.G_MISS_CHAR)
3461       THEN
3462         x_bclv_rec.attribute1 := l_bclv_rec.attribute1;
3463       END IF;
3464       IF (x_bclv_rec.attribute2 = OKC_API.G_MISS_CHAR)
3465       THEN
3466         x_bclv_rec.attribute2 := l_bclv_rec.attribute2;
3467       END IF;
3468       IF (x_bclv_rec.attribute3 = OKC_API.G_MISS_CHAR)
3469       THEN
3470         x_bclv_rec.attribute3 := l_bclv_rec.attribute3;
3471       END IF;
3472       IF (x_bclv_rec.attribute4 = OKC_API.G_MISS_CHAR)
3473       THEN
3474         x_bclv_rec.attribute4 := l_bclv_rec.attribute4;
3475       END IF;
3476       IF (x_bclv_rec.attribute5 = OKC_API.G_MISS_CHAR)
3477       THEN
3478         x_bclv_rec.attribute5 := l_bclv_rec.attribute5;
3479       END IF;
3480       IF (x_bclv_rec.attribute6 = OKC_API.G_MISS_CHAR)
3481       THEN
3482         x_bclv_rec.attribute6 := l_bclv_rec.attribute6;
3483       END IF;
3484       IF (x_bclv_rec.attribute7 = OKC_API.G_MISS_CHAR)
3485       THEN
3486         x_bclv_rec.attribute7 := l_bclv_rec.attribute7;
3487       END IF;
3488       IF (x_bclv_rec.attribute8 = OKC_API.G_MISS_CHAR)
3489       THEN
3490         x_bclv_rec.attribute8 := l_bclv_rec.attribute8;
3491       END IF;
3492       IF (x_bclv_rec.attribute9 = OKC_API.G_MISS_CHAR)
3493       THEN
3494         x_bclv_rec.attribute9 := l_bclv_rec.attribute9;
3495       END IF;
3496       IF (x_bclv_rec.attribute10 = OKC_API.G_MISS_CHAR)
3497       THEN
3498         x_bclv_rec.attribute10 := l_bclv_rec.attribute10;
3499       END IF;
3500       IF (x_bclv_rec.attribute11 = OKC_API.G_MISS_CHAR)
3501       THEN
3502         x_bclv_rec.attribute11 := l_bclv_rec.attribute11;
3503       END IF;
3504       IF (x_bclv_rec.attribute12 = OKC_API.G_MISS_CHAR)
3505       THEN
3506         x_bclv_rec.attribute12 := l_bclv_rec.attribute12;
3507       END IF;
3508       IF (x_bclv_rec.attribute13 = OKC_API.G_MISS_CHAR)
3509       THEN
3510         x_bclv_rec.attribute13 := l_bclv_rec.attribute13;
3511       END IF;
3512       IF (x_bclv_rec.attribute14 = OKC_API.G_MISS_CHAR)
3513       THEN
3514         x_bclv_rec.attribute14 := l_bclv_rec.attribute14;
3515       END IF;
3516       IF (x_bclv_rec.attribute15 = OKC_API.G_MISS_CHAR)
3517       THEN
3518         x_bclv_rec.attribute15 := l_bclv_rec.attribute15;
3519       END IF;
3520       IF (x_bclv_rec.created_by = OKC_API.G_MISS_NUM)
3521       THEN
3522         x_bclv_rec.created_by := l_bclv_rec.created_by;
3523       END IF;
3524       IF (x_bclv_rec.creation_date = OKC_API.G_MISS_DATE)
3525       THEN
3526         x_bclv_rec.creation_date := l_bclv_rec.creation_date;
3527       END IF;
3528       IF (x_bclv_rec.last_updated_by = OKC_API.G_MISS_NUM)
3529       THEN
3530         x_bclv_rec.last_updated_by := l_bclv_rec.last_updated_by;
3531       END IF;
3532       IF (x_bclv_rec.last_update_date = OKC_API.G_MISS_DATE)
3533       THEN
3534         x_bclv_rec.last_update_date := l_bclv_rec.last_update_date;
3535       END IF;
3536       IF (x_bclv_rec.last_update_login = OKC_API.G_MISS_NUM)
3537       THEN
3538         x_bclv_rec.last_update_login := l_bclv_rec.last_update_login;
3539       END IF;
3540       RETURN(l_return_status);
3541     END populate_new_record;
3542     ----------------------------------------------
3543     -- Set_Attributes for:OKS_BILL_CONT_LINES_V --
3544     ----------------------------------------------
3545     FUNCTION Set_Attributes (
3546       p_bclv_rec IN  bclv_rec_type,
3547       x_bclv_rec OUT NOCOPY bclv_rec_type
3548     ) RETURN VARCHAR2 IS
3549       l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3550     BEGIN
3551       x_bclv_rec := p_bclv_rec;
3552       x_bclv_rec.OBJECT_VERSION_NUMBER := NVL(x_bclv_rec.OBJECT_VERSION_NUMBER, 0) + 1;
3553       RETURN(l_return_status);
3554     END Set_Attributes;
3555   BEGIN
3556     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3557                                               G_PKG_NAME,
3558                                               p_init_msg_list,
3559                                               l_api_version,
3560                                               p_api_version,
3561                                               '_PVT',
3562                                               x_return_status);
3563     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3564       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3565     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3566       RAISE OKC_API.G_EXCEPTION_ERROR;
3567     END IF;
3568     --- Setting item attributes
3569     l_return_status := Set_Attributes(
3570       p_bclv_rec,                        -- IN
3571       l_bclv_rec);                       -- OUT
3572     --- If any errors happen abort API
3573     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3574       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3575     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3576       RAISE OKC_API.G_EXCEPTION_ERROR;
3577     END IF;
3578     l_return_status := populate_new_record(l_bclv_rec, l_def_bclv_rec);
3579     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3580       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3581     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3582       RAISE OKC_API.G_EXCEPTION_ERROR;
3583     END IF;
3584     l_def_bclv_rec := fill_who_columns(l_def_bclv_rec);
3585     --- Validate all non-missing attributes (Item Level Validation)
3586     l_return_status := Validate_Attributes(l_def_bclv_rec);
3587     --- If any errors happen abort API
3588     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3589       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3590     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3591       RAISE OKC_API.G_EXCEPTION_ERROR;
3592     END IF;
3593     l_return_status := Validate_Record(l_def_bclv_rec);
3594     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3595       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3596     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3597       RAISE OKC_API.G_EXCEPTION_ERROR;
3598     END IF;
3599 
3600     --------------------------------------
3601     -- Move VIEW record to "Child" records
3602     --------------------------------------
3603     migrate(l_def_bclv_rec, l_bcl_rec);
3604     --------------------------------------------
3605     -- Call the UPDATE_ROW for each child record
3606     --------------------------------------------
3607     update_row(
3608       p_init_msg_list,
3609       x_return_status,
3610       x_msg_count,
3611       x_msg_data,
3612       l_bcl_rec,
3613       lx_bcl_rec
3614     );
3615     IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3616       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3617     ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
3618       RAISE OKC_API.G_EXCEPTION_ERROR;
3619     END IF;
3620     migrate(lx_bcl_rec, l_def_bclv_rec);
3621     x_bclv_rec := l_def_bclv_rec;
3622     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3623   EXCEPTION
3624     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3625       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3626       (
3627         l_api_name,
3628         G_PKG_NAME,
3629         'OKC_API.G_RET_STS_ERROR',
3630         x_msg_count,
3631         x_msg_data,
3632         '_PVT'
3633       );
3634     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3635       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3636       (
3637         l_api_name,
3638         G_PKG_NAME,
3639         'OKC_API.G_RET_STS_UNEXP_ERROR',
3640         x_msg_count,
3641         x_msg_data,
3642         '_PVT'
3643       );
3644     WHEN OTHERS THEN
3645       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3646       (
3647         l_api_name,
3648         G_PKG_NAME,
3649         'OTHERS',
3650         x_msg_count,
3651         x_msg_data,
3652         '_PVT'
3653       );
3654   END update_row;
3655   ----------------------------------------
3656   -- PL/SQL TBL update_row for:BCLV_TBL --
3657   ----------------------------------------
3658   PROCEDURE update_row(
3659     p_api_version                  IN NUMBER,
3660     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3661     x_return_status                OUT NOCOPY VARCHAR2,
3662     x_msg_count                    OUT NOCOPY NUMBER,
3663     x_msg_data                     OUT NOCOPY VARCHAR2,
3664     p_bclv_tbl                     IN bclv_tbl_type,
3665     x_bclv_tbl                     OUT NOCOPY bclv_tbl_type) IS
3666 
3667     l_api_version                 CONSTANT NUMBER := 1;
3668     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3669     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3670     i                              NUMBER := 0;
3671   BEGIN
3672     OKC_API.init_msg_list(p_init_msg_list);
3673     -- Make sure PL/SQL table has records in it before passing
3674     IF (p_bclv_tbl.COUNT > 0) THEN
3675       i := p_bclv_tbl.FIRST;
3676       LOOP
3677         update_row (
3678           p_api_version                  => p_api_version,
3679           p_init_msg_list                => OKC_API.G_FALSE,
3680           x_return_status                => x_return_status,
3681           x_msg_count                    => x_msg_count,
3682           x_msg_data                     => x_msg_data,
3683           p_bclv_rec                     => p_bclv_tbl(i),
3684           x_bclv_rec                     => x_bclv_tbl(i));
3685         EXIT WHEN (i = p_bclv_tbl.LAST);
3686         i := p_bclv_tbl.NEXT(i);
3687       END LOOP;
3688     END IF;
3689   EXCEPTION
3690     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3691       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3692       (
3693         l_api_name,
3694         G_PKG_NAME,
3695         'OKC_API.G_RET_STS_ERROR',
3696         x_msg_count,
3697         x_msg_data,
3698         '_PVT'
3699       );
3700     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3701       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3702       (
3703         l_api_name,
3704         G_PKG_NAME,
3705         'OKC_API.G_RET_STS_UNEXP_ERROR',
3706         x_msg_count,
3707         x_msg_data,
3708         '_PVT'
3709       );
3710     WHEN OTHERS THEN
3711       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3712       (
3713         l_api_name,
3714         G_PKG_NAME,
3715         'OTHERS',
3716         x_msg_count,
3717         x_msg_data,
3718         '_PVT'
3719       );
3720   END update_row;
3721 
3722   ---------------------------------------------------------------------------
3723   -- PROCEDURE delete_row
3724   ---------------------------------------------------------------------------
3725   ----------------------------------------
3726   -- delete_row for:OKS_BILL_CONT_LINES --
3727   ----------------------------------------
3728   PROCEDURE delete_row(
3729     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3730     x_return_status                OUT NOCOPY VARCHAR2,
3731     x_msg_count                    OUT NOCOPY NUMBER,
3732     x_msg_data                     OUT NOCOPY VARCHAR2,
3733     p_bcl_rec                      IN bcl_rec_type) IS
3734 
3735     l_api_version                 CONSTANT NUMBER := 1;
3736     l_api_name                     CONSTANT VARCHAR2(30) := 'LINES_delete_row';
3737     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3738     l_bcl_rec                      bcl_rec_type:= p_bcl_rec;
3739     l_row_notfound                 BOOLEAN := TRUE;
3740   BEGIN
3741     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3742                                               p_init_msg_list,
3743                                               '_PVT',
3744                                               x_return_status);
3745     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3746       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3747     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3748       RAISE OKC_API.G_EXCEPTION_ERROR;
3749     END IF;
3750     DELETE FROM OKS_BILL_CONT_LINES
3751      WHERE ID = l_bcl_rec.id;
3752 
3753     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3754   EXCEPTION
3755     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3756       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3757       (
3758         l_api_name,
3759         G_PKG_NAME,
3760         'OKC_API.G_RET_STS_ERROR',
3761         x_msg_count,
3762         x_msg_data,
3763         '_PVT'
3764       );
3765     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3766       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3767       (
3768         l_api_name,
3769         G_PKG_NAME,
3770         'OKC_API.G_RET_STS_UNEXP_ERROR',
3771         x_msg_count,
3772         x_msg_data,
3773         '_PVT'
3774       );
3775     WHEN OTHERS THEN
3776       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3777       (
3778         l_api_name,
3779         G_PKG_NAME,
3780         'OTHERS',
3781         x_msg_count,
3782         x_msg_data,
3783         '_PVT'
3784       );
3785   END delete_row;
3786   ------------------------------------------
3787   -- delete_row for:OKS_BILL_CONT_LINES_V --
3788   ------------------------------------------
3789   PROCEDURE delete_row(
3790     p_api_version                  IN NUMBER,
3791     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3792     x_return_status                OUT NOCOPY VARCHAR2,
3793     x_msg_count                    OUT NOCOPY NUMBER,
3794     x_msg_data                     OUT NOCOPY VARCHAR2,
3795     p_bclv_rec                     IN bclv_rec_type) IS
3796 
3797     l_api_version                 CONSTANT NUMBER := 1;
3798     l_api_name                     CONSTANT VARCHAR2(30) := 'V_delete_row';
3799     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3800     l_bclv_rec                     bclv_rec_type := p_bclv_rec;
3801     l_bcl_rec                      bcl_rec_type;
3802   BEGIN
3803     l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3804                                               G_PKG_NAME,
3805                                               p_init_msg_list,
3806                                               l_api_version,
3807                                               p_api_version,
3808                                               '_PVT',
3809                                               x_return_status);
3810     IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3811       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3812     ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3813       RAISE OKC_API.G_EXCEPTION_ERROR;
3814     END IF;
3815     --------------------------------------
3816     -- Move VIEW record to "Child" records
3817     --------------------------------------
3818     migrate(l_bclv_rec, l_bcl_rec);
3819     --------------------------------------------
3820     -- Call the DELETE_ROW for each child record
3821     --------------------------------------------
3822     delete_row(
3823       p_init_msg_list,
3824       x_return_status,
3825       x_msg_count,
3826       x_msg_data,
3827       l_bcl_rec
3828     );
3829     IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3830       RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3831     ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
3832       RAISE OKC_API.G_EXCEPTION_ERROR;
3833     END IF;
3834     OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3835   EXCEPTION
3836     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3837       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3838       (
3839         l_api_name,
3840         G_PKG_NAME,
3841         'OKC_API.G_RET_STS_ERROR',
3842         x_msg_count,
3843         x_msg_data,
3844         '_PVT'
3845       );
3846     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3847       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3848       (
3849         l_api_name,
3850         G_PKG_NAME,
3851         'OKC_API.G_RET_STS_UNEXP_ERROR',
3852         x_msg_count,
3853         x_msg_data,
3854         '_PVT'
3855       );
3856     WHEN OTHERS THEN
3857       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3858       (
3859         l_api_name,
3860         G_PKG_NAME,
3861         'OTHERS',
3862         x_msg_count,
3863         x_msg_data,
3864         '_PVT'
3865       );
3866   END delete_row;
3867   ----------------------------------------
3868   -- PL/SQL TBL delete_row for:BCLV_TBL --
3869   ----------------------------------------
3870   PROCEDURE delete_row(
3871     p_api_version                  IN NUMBER,
3872     p_init_msg_list                IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3873     x_return_status                OUT NOCOPY VARCHAR2,
3874     x_msg_count                    OUT NOCOPY NUMBER,
3875     x_msg_data                     OUT NOCOPY VARCHAR2,
3876     p_bclv_tbl                     IN bclv_tbl_type) IS
3877 
3878     l_api_version                 CONSTANT NUMBER := 1;
3879     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3880     l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3881     i                              NUMBER := 0;
3882   BEGIN
3883     OKC_API.init_msg_list(p_init_msg_list);
3884     -- Make sure PL/SQL table has records in it before passing
3885     IF (p_bclv_tbl.COUNT > 0) THEN
3886       i := p_bclv_tbl.FIRST;
3887       LOOP
3888         delete_row (
3889           p_api_version                  => p_api_version,
3890           p_init_msg_list                => OKC_API.G_FALSE,
3891           x_return_status                => x_return_status,
3892           x_msg_count                    => x_msg_count,
3893           x_msg_data                     => x_msg_data,
3894           p_bclv_rec                     => p_bclv_tbl(i));
3895         EXIT WHEN (i = p_bclv_tbl.LAST);
3896         i := p_bclv_tbl.NEXT(i);
3897       END LOOP;
3898     END IF;
3899   EXCEPTION
3900     WHEN OKC_API.G_EXCEPTION_ERROR THEN
3901       x_return_status := OKC_API.HANDLE_EXCEPTIONS
3902       (
3903         l_api_name,
3904         G_PKG_NAME,
3905         'OKC_API.G_RET_STS_ERROR',
3906         x_msg_count,
3907         x_msg_data,
3908         '_PVT'
3909       );
3910     WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3911       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3912       (
3913         l_api_name,
3914         G_PKG_NAME,
3915         'OKC_API.G_RET_STS_UNEXP_ERROR',
3916         x_msg_count,
3917         x_msg_data,
3918         '_PVT'
3919       );
3920     WHEN OTHERS THEN
3921       x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3922       (
3923         l_api_name,
3924         G_PKG_NAME,
3925         'OTHERS',
3926         x_msg_count,
3927         x_msg_data,
3928         '_PVT'
3929       );
3930   END delete_row;
3931 
3932 
3933 PROCEDURE INSERT_ROW_UPG(p_bclv_tbl bclv_tbl_type) IS
3934   l_tabsize NUMBER := p_bclv_tbl.COUNT;
3935   l_source_lang VARCHAR2(12) := okc_util.get_userenv_lang;
3936 TYPE Var720TabTyp IS TABLE OF Varchar2(720)
3937      INDEX BY BINARY_INTEGER;
3938 
3939   in_id                            OKC_DATATYPES.NumberTabTyp;
3940   in_cle_id                        OKC_DATATYPES.NumberTabTyp;
3941   in_btn_id                        OKC_DATATYPES.NumberTabTyp;
3942   in_date_billed_from              OKC_DATATYPES.DateTabTyp;
3943   in_date_billed_to                OKC_DATATYPES.DateTabTyp;
3944   in_sent_yn                       OKC_DATATYPES.Var3TabTyp;
3945   in_currency_code                 OKC_DATATYPES.Var15TabTyp;
3946   in_amount                        OKC_DATATYPES.NumberTabTyp;
3947   in_bill_action                   Var9TabTyp;
3948   in_object_version_number         OKC_DATATYPES.NumberTabTyp;
3949   in_date_next_invoice             OKC_DATATYPES.DateTabTyp;
3950   in_attribute_category            OKC_DATATYPES.Var90TabTyp;
3951   in_attribute1                    OKC_DATATYPES.Var450TabTyp;
3952   in_attribute2                    OKC_DATATYPES.Var450TabTyp;
3953   in_attribute3                    OKC_DATATYPES.Var450TabTyp;
3954   in_attribute4                    OKC_DATATYPES.Var450TabTyp;
3955   in_attribute5                    OKC_DATATYPES.Var450TabTyp;
3956   in_attribute6                    OKC_DATATYPES.Var450TabTyp;
3957   in_attribute7                    OKC_DATATYPES.Var450TabTyp;
3958   in_attribute8                    OKC_DATATYPES.Var450TabTyp;
3959   in_attribute9                    OKC_DATATYPES.Var450TabTyp;
3960   in_attribute10                   OKC_DATATYPES.Var450TabTyp;
3961   in_attribute11                   OKC_DATATYPES.Var450TabTyp;
3962   in_attribute12                   OKC_DATATYPES.Var450TabTyp;
3963   in_attribute13                   OKC_DATATYPES.Var450TabTyp;
3964   in_attribute14                   OKC_DATATYPES.Var450TabTyp;
3965   in_attribute15                   OKC_DATATYPES.Var450TabTyp;
3966   in_created_by                    OKC_DATATYPES.NumberTabTyp;
3967   in_creation_date                 OKC_DATATYPES.DateTabTyp;
3968   in_last_updated_by               OKC_DATATYPES.NumberTabTyp;
3969   in_last_update_date              OKC_DATATYPES.DateTabTyp;
3970   in_last_update_login             OKC_DATATYPES.NumberTabTyp;
3971   i number;
3972   j number;
3973 BEGIN
3974   i := p_bclv_tbl.FIRST; j:=0;
3975   while i is not null
3976   LOOP
3977     j:=j+1;
3978     in_id                            (j) := p_bclv_tbl(i).id;
3979     in_cle_id                        (j) := p_bclv_tbl(i).cle_id;
3980     in_btn_id                        (j) := p_bclv_tbl(i).btn_id;
3981     in_date_billed_from              (j) := p_bclv_tbl(i).date_billeD_from;
3982     in_date_billed_to                (j) := p_bclv_tbl(i).date_billed_to;
3983     in_sent_yn                       (j) := p_bclv_tbl(i).sent_yn;
3984     in_currency_code                 (j) := p_bclv_tbl(i).currency_code;
3985     in_amount                        (j) := p_bclv_tbl(i).amount;
3986     in_bill_action                   (j) := p_bclv_tbl(i).bill_action;
3987     in_object_version_number         (j) := p_bclv_tbl(i).object_version_number;
3988     in_date_next_invoice             (j) := p_bclv_tbl(i).date_next_invoice;
3989     in_attribute_category            (j) := p_bclv_tbl(i).attribute_category;
3990     in_attribute1                    (j) := p_bclv_tbl(i).attribute1;
3991     in_attribute2                    (j) := p_bclv_tbl(i).attribute2;
3992     in_attribute3                    (j) := p_bclv_tbl(i).attribute3;
3993     in_attribute4                    (j) := p_bclv_tbl(i).attribute4;
3994     in_attribute5                    (j) := p_bclv_tbl(i).attribute5;
3995     in_attribute6                    (j) := p_bclv_tbl(i).attribute6;
3996     in_attribute7                    (j) := p_bclv_tbl(i).attribute7;
3997     in_attribute8                    (j) := p_bclv_tbl(i).attribute8;
3998     in_attribute9                    (j) := p_bclv_tbl(i).attribute9;
3999     in_attribute10                   (j) := p_bclv_tbl(i).attribute10;
4000     in_attribute11                   (j) := p_bclv_tbl(i).attribute11;
4001     in_attribute12                   (j) := p_bclv_tbl(i).attribute12;
4002     in_attribute13                   (j) := p_bclv_tbl(i).attribute13;
4003     in_attribute14                   (j) := p_bclv_tbl(i).attribute14;
4004     in_attribute15                   (j) := p_bclv_tbl(i).attribute15;
4005     in_created_by                    (j) := p_bclv_tbl(i).created_by;
4006     in_creation_date                 (j) := p_bclv_tbl(i).creation_date;
4007     in_last_updated_by               (j) := p_bclv_tbl(i).last_updated_by;
4008     in_last_update_date              (j) := p_bclv_tbl(i).last_update_date;
4009     in_last_update_login             (j) := p_bclv_tbl(i).last_update_login;
4010 
4011     i:=p_bclv_tbl.next(i);
4012   END LOOP;
4013 
4014   FORALL i in 1..l_tabsize
4015     INSERT
4016       INTO OKS_BILL_CONT_LINES
4017       (
4018         id ,
4019         cle_id,
4020         btn_id ,
4021         date_billed_from ,
4022         date_billed_to,
4023         sent_yn,
4024         currency_code,
4025         object_version_number,
4026         amount,
4027         bill_action ,
4028         date_next_invoice ,
4029         attribute_category ,
4030         attribute1 ,
4031         attribute2 ,
4032         attribute3 ,
4033         attribute4 ,
4034         attribute5 ,
4035         attribute6 ,
4036         attribute7 ,
4037         attribute8 ,
4038         attribute9 ,
4039         attribute10 ,
4040         attribute11 ,
4041         attribute12 ,
4042         attribute13 ,
4043         attribute14 ,
4044         attribute15 ,
4045         created_by ,
4046         creation_date ,
4047         last_updated_by ,
4048         last_update_date ,
4049         last_update_login
4050      )
4051      VALUES (
4052         in_id(i),
4053         in_cle_id(i),
4054         in_btn_id(i),
4055         in_date_billed_from(i),
4056         in_date_billed_to(i),
4057         in_sent_yn(i),
4058         in_currency_code(i),
4059         in_object_version_number(i),
4060         in_amount(i),
4061         in_bill_action (i),
4062         in_date_next_invoice(i),
4063         in_attribute_category(i),
4064         in_attribute1(i),
4065         in_attribute2(i),
4066         in_attribute3(i),
4067         in_attribute4(i),
4068         in_attribute5(i),
4069         in_attribute6(i),
4070         in_attribute7(i),
4071         in_attribute8(i),
4072         in_attribute9(i),
4073         in_attribute10(i),
4074         in_attribute11(i),
4075         in_attribute12(i),
4076         in_attribute13(i),
4077         in_attribute14(i),
4078         in_attribute15(i),
4079         in_created_by(i),
4080         in_creation_date(i),
4081         in_last_updated_by(i),
4082         in_last_update_date(i),
4083         in_last_update_login(i)
4084      );
4085 
4086 EXCEPTION
4087   WHEN OTHERS THEN
4088     RAISE;
4089 END INSERT_ROW_UPG;
4090 END OKS_BCL_PVT;