DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKC_OLE_PVT

Source


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