[Home] [Help]
PACKAGE BODY: APPS.OKC_COP_PVT
Source
1 PACKAGE BODY OKC_COP_PVT AS
2 /* $Header: OKCSCOPB.pls 120.0 2005/05/26 09:53:59 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_copv_rec IN copv_rec_type) RETURN VARCHAR2;
9 --G_CHILD_RECORD_EXISTS CONSTANT VARCHAR2(200) := 'OKC_CANNOT_DELETE_MASTER';
10 --G_TABLE_TOKEN CONSTANT VARCHAR2(200) := OKC_API.G_CHILD_TABLE_TOKEN;
11 G_SQLERRM_TOKEN CONSTANT VARCHAR2(200) := 'SQLerrm';
12 G_SQLCODE_TOKEN CONSTANT VARCHAR2(200) := 'SQLcode';
13 G_NO_PARENT_RECORD CONSTANT VARCHAR2(200) := 'OKC_NO_PARENT_RECORD';
14 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(200) := 'OKC_CONTRACTS_UNEXPECTED_ERROR';
15 G_VIEW CONSTANT VARCHAR2(200) := 'OKC_CLASS_OPERATIONS_V';
16 G_EXCEPTION_HALT_VALIDATION exception;
17 --l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
18
19 -- Start of comments
20 --
21 -- Procedure Name : validate_opn_code
22 -- Description :
23 -- Business Rules :
24 -- Parameters :
25 -- Version : 1.0
26 -- End of comments
27 PROCEDURE validate_opn_code(x_return_status OUT NOCOPY VARCHAR2,
28 p_copv_rec IN copv_rec_type) is
29 l_dummy_var VARCHAR2(1) := '?';
30 CURSOR l_opnv_csr (p_code IN VARCHAR2) IS
31 SELECT 'x'
32 FROM okc_operations_b
33 WHERE code = p_code;
34 Begin
35 -- initialize return status
36 x_return_status := OKC_API.G_RET_STS_SUCCESS;
37
38 -- check that data exists
39 If (p_copv_rec.opn_code = OKC_API.G_MISS_CHAR or
40 p_copv_rec.opn_code IS NULL)
41 Then
42 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
43 p_msg_name => g_required_value,
44 p_token1 => g_col_name_token,
45 p_token1_value => 'Operation Code');
46 -- notify caller of an error
47 x_return_status := OKC_API.G_RET_STS_ERROR;
48
49 -- halt validation
50 raise G_EXCEPTION_HALT_VALIDATION;
51 End If;
52
53 -- Check foreign key
54 Open l_opnv_csr(p_copv_rec.opn_code);
55 Fetch l_opnv_csr into l_dummy_var;
56 Close l_opnv_csr;
57
58 -- if l_dummy_var still set to default, data was not found
59 If (l_dummy_var = '?') Then
60 OKC_API.SET_MESSAGE(
61 p_app_name => g_app_name,
62 p_msg_name => g_no_parent_record,
63 p_token1 => g_col_name_token,
64 p_token1_value => 'Operation Code',
65 p_token2 => g_child_table_token,
66 p_token2_value => G_VIEW,
67 p_token3 => g_parent_table_token,
68 p_token3_value => 'OKC_OPERATIONS_V');
69 -- notify caller of an error
70 x_return_status := OKC_API.G_RET_STS_ERROR;
71 End If;
72 exception
73 when G_EXCEPTION_HALT_VALIDATION then
74 -- no processing necessary; validation can continue with next column
75 null;
76
77 when OTHERS then
78 -- store SQL error message on message stack
79 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
80 p_msg_name => g_unexpected_error,
81 p_token1 => g_sqlcode_token,
82 p_token1_value => sqlcode,
83 p_token2 => g_sqlerrm_token,
84 p_token2_value => sqlerrm);
85 -- notify caller of an error as UNEXPETED error
86 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
87 End validate_opn_code;
88
89 -- Start of comments
90 --
91 -- Procedure Name : validate_cls_code
92 -- Description :
93 -- Business Rules :
94 -- Parameters :
95 -- Version : 1.0
96 -- End of comments
97 PROCEDURE validate_cls_code(x_return_status OUT NOCOPY VARCHAR2,
98 p_copv_rec IN copv_rec_type) is
99 l_dummy_var VARCHAR2(1) := '?';
100 CURSOR l_clsv_csr (p_code IN VARCHAR2) IS
101 SELECT 'x'
102 FROM okc_classes_b
103 WHERE code = p_code;
104 Begin
105 -- initialize return status
106 x_return_status := OKC_API.G_RET_STS_SUCCESS;
107
108 -- check that data exists
109 If (p_copv_rec.cls_code = OKC_API.G_MISS_CHAR or
110 p_copv_rec.cls_code IS NULL)
111 Then
112 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
113 p_msg_name => g_required_value,
114 p_token1 => g_col_name_token,
115 p_token1_value => 'Class Code');
116 -- notify caller of an error
117 x_return_status := OKC_API.G_RET_STS_ERROR;
118
119 -- halt validation
120 raise G_EXCEPTION_HALT_VALIDATION;
121 End If;
122
123 -- Check foreign key
124 Open l_clsv_csr(p_copv_rec.cls_code);
125 Fetch l_clsv_csr into l_dummy_var;
126 Close l_clsv_csr;
127
128 -- if l_dummy_var still set to default, data was not found
129 If (l_dummy_var = '?') Then
130 OKC_API.SET_MESSAGE(
131 p_app_name => g_app_name,
132 p_msg_name => g_no_parent_record,
133 p_token1 => g_col_name_token,
134 p_token1_value => 'Class Code',
135 p_token2 => g_child_table_token,
136 p_token2_value => G_VIEW,
137 p_token3 => g_parent_table_token,
138 p_token3_value => 'OKC_CLASSES_V');
139 -- notify caller of an error
140 x_return_status := OKC_API.G_RET_STS_ERROR;
141 End If;
142 exception
143 when G_EXCEPTION_HALT_VALIDATION then
144 -- no processing necessary; validation can continue with next column
145 null;
146
150 p_msg_name => g_unexpected_error,
147 when OTHERS then
148 -- store SQL error message on message stack
149 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
151 p_token1 => g_sqlcode_token,
152 p_token1_value => sqlcode,
153 p_token2 => g_sqlerrm_token,
154 p_token2_value => sqlerrm);
155 -- notify caller of an error as UNEXPETED error
156 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
157 End validate_cls_code;
158
159 -- Start of comments
160 --
161 -- Procedure Name : validate_search_function_id
162 -- Description :
163 -- Business Rules :
164 -- Parameters :
165 -- Version : 1.0
166 -- End of comments
167 PROCEDURE validate_search_function_id(x_return_status OUT NOCOPY VARCHAR2,
168 p_copv_rec IN copv_rec_type) is
169
170 l_dummy_var VARCHAR2(1) := '?';
171 Cursor l_fndv_csr Is
172 select 'x'
173 from FND_FORM_FUNCTIONS
174 where function_id = p_copv_rec.search_function_id;
175
176 Begin
177 -- initialize return status
178 x_return_status := OKC_API.G_RET_STS_SUCCESS;
179
180 -- enforce foreign key (search_function_id is optional)
181 If (p_copv_rec.search_function_id <> OKC_API.G_MISS_NUM and
182 p_copv_rec.search_function_id IS NOT NULL)
183 Then
184 Open l_fndv_csr;
185 Fetch l_fndv_csr Into l_dummy_var;
186 Close l_fndv_csr;
187 -- if l_dummy_var still set to default, data was not found
188 If (l_dummy_var = '?') Then
189 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
190 p_msg_name => g_no_parent_record,
191 p_token1 => g_col_name_token,
192 p_token1_value => 'Search Function Id',
193 p_token2 => g_child_table_token,
194 p_token2_value => G_VIEW,
195 p_token3 => g_parent_table_token,
196 p_token3_value => 'FND_FORM_FUNCTIONS');
197 -- notify caller of an error
198 x_return_status := OKC_API.G_RET_STS_ERROR;
199 End If;
200 End If;
201 exception
202 when OTHERS then
203 -- store SQL error message on message stack
204 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
205 p_msg_name => g_unexpected_error,
206 p_token1 => g_sqlcode_token,
207 p_token1_value => sqlcode,
208 p_token2 => g_sqlerrm_token,
209 p_token2_value => sqlerrm);
210 -- notify caller of an error as UNEXPETED error
211 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
212
213 -- verify that cursor was closed
214 if l_fndv_csr%ISOPEN then
215 close l_fndv_csr;
216 end if;
217
218 End validate_search_function_id;
219
220 -- Start of comments
221 --
222 -- Procedure Name : validate_detail_function_id
223 -- Description :
224 -- Business Rules :
225 -- Parameters :
226 -- Version : 1.0
227 -- End of comments
228 PROCEDURE validate_detail_function_id(x_return_status OUT NOCOPY VARCHAR2,
229 p_copv_rec IN copv_rec_type) is
230
231 l_dummy_var VARCHAR2(1) := '?';
232 Cursor l_fndv_csr Is
233 select 'x'
234 from FND_FORM_FUNCTIONS
235 where function_id = p_copv_rec.detail_function_id;
236
237 Begin
238 -- initialize return status
239 x_return_status := OKC_API.G_RET_STS_SUCCESS;
240
241 -- enforce foreign key (detail_function_id is optional)
242 If (p_copv_rec.detail_function_id <> OKC_API.G_MISS_NUM and
243 p_copv_rec.detail_function_id IS NOT NULL)
244 Then
245 Open l_fndv_csr;
246 Fetch l_fndv_csr Into l_dummy_var;
247 Close l_fndv_csr;
248 -- if l_dummy_var still set to default, data was not found
249 If (l_dummy_var = '?') Then
250 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
251 p_msg_name => g_no_parent_record,
252 p_token1 => g_col_name_token,
253 p_token1_value => 'Detail Function Id',
254 p_token2 => g_child_table_token,
255 p_token2_value => G_VIEW,
256 p_token3 => g_parent_table_token,
257 p_token3_value => 'FND_FORM_FUNCTIONS');
258 -- notify caller of an error
259 x_return_status := OKC_API.G_RET_STS_ERROR;
260 End If;
261 End If;
262 exception
263 when OTHERS then
264 -- store SQL error message on message stack
265 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
266 p_msg_name => g_unexpected_error,
267 p_token1 => g_sqlcode_token,
268 p_token1_value => sqlcode,
269 p_token2 => g_sqlerrm_token,
270 p_token2_value => sqlerrm);
271 -- notify caller of an error as UNEXPETED error
272 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
273
274 -- verify that cursor was closed
275 if l_fndv_csr%ISOPEN then
276 close l_fndv_csr;
277 end if;
278
279 End validate_detail_function_id;
280
281 -- Start of comments
282 --
283 -- Procedure Name : validate_pdf_id
284 -- Description :
285 -- Business Rules :
286 -- Parameters :
287 -- Version : 1.0
288 -- End of comments
289 PROCEDURE validate_pdf_id(x_return_status OUT NOCOPY VARCHAR2,
290 p_copv_rec IN copv_rec_type) is
291
292 l_dummy_var VARCHAR2(1) := '?';
293 Cursor l_pdfv_csr Is
294 select 'x'
295 from OKC_PROCESS_DEFS_B
296 where id = p_copv_rec.pdf_id;
297
298 Begin
302 -- enforce foreign key (pdf_id is optional)
299 -- initialize return status
300 x_return_status := OKC_API.G_RET_STS_SUCCESS;
301
303 If (p_copv_rec.pdf_id <> OKC_API.G_MISS_NUM and
304 p_copv_rec.pdf_id IS NOT NULL)
305 Then
306 Open l_pdfv_csr;
307 Fetch l_pdfv_csr Into l_dummy_var;
308 Close l_pdfv_csr;
309 -- if l_dummy_var still set to default, data was not found
310 If (l_dummy_var = '?') Then
311 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
312 p_msg_name => g_no_parent_record,
313 p_token1 => g_col_name_token,
314 p_token1_value => 'Detail Function Id',
315 p_token2 => g_child_table_token,
316 p_token2_value => G_VIEW,
317 p_token3 => g_parent_table_token,
318 p_token3_value => 'pdf_FORM_FUNCTIONS');
319 -- notify caller of an error
320 x_return_status := OKC_API.G_RET_STS_ERROR;
321 End If;
322 End If;
323 exception
324 when OTHERS then
325 -- store SQL error message on message stack
326 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
327 p_msg_name => g_unexpected_error,
328 p_token1 => g_sqlcode_token,
329 p_token1_value => sqlcode,
330 p_token2 => g_sqlerrm_token,
331 p_token2_value => sqlerrm);
332 -- notify caller of an error as UNEXPETED error
333 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
334
335 -- verify that cursor was closed
336 if l_pdfv_csr%ISOPEN then
337 close l_pdfv_csr;
338 end if;
339
340 End validate_pdf_id;
341
342
343 -- added DEC 10, 2001
344 -- Start of comments
345 --
346 -- Procedure Name : validate_grid_datasource_name
347 -- Description :
348 -- Business Rules :
349 -- Parameters :
350 -- Version : 1.0
351 -- End of comments
352 PROCEDURE validate_grid_datasource_name(x_return_status OUT NOCOPY VARCHAR2,
353 p_copv_rec IN copv_rec_type) is
354
355 l_dummy_var VARCHAR2(1) := '?';
356 CURSOR l_grid_csr IS
357 SELECT 'x'
358 FROM jtf_grid_datasources_b
359 WHERE grid_datasource_name = p_copv_rec.grid_datasource_name;
360 Begin
361
362 -- initialize return status
363 x_return_status := OKC_API.G_RET_STS_SUCCESS;
364
365 -- enforce foreign key (grid_datasource_name is optional)
366 If (p_copv_rec.grid_datasource_name <> OKC_API.G_MISS_CHAR and
367 p_copv_rec.grid_datasource_name IS NOT NULL)
368 Then
369 Open l_grid_csr;
370 Fetch l_grid_csr Into l_dummy_var;
371 Close l_grid_csr;
372 -- if l_dummy_var still set to default, data was not found
373 If (l_dummy_var = '?') Then
374 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
375 p_msg_name => g_no_parent_record,
376 p_token1 => g_col_name_token,
377 p_token1_value => 'Grid Data Source Name',
378 p_token2 => g_child_table_token,
379 p_token2_value => G_VIEW,
380 p_token3 => g_parent_table_token,
381 p_token3_value => 'JTF_GRID_DATASOURCES_VL');
382 -- notify caller of an error
383 x_return_status := OKC_API.G_RET_STS_ERROR;
384 End If;
385 End If;
386
387 exception
388 when OTHERS then
389 -- store SQL error message on message stack
390 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
391 p_msg_name => g_unexpected_error,
392 p_token1 => g_sqlcode_token,
393 p_token1_value => sqlcode,
394 p_token2 => g_sqlerrm_token,
395 p_token2_value => sqlerrm);
396 -- notify caller of an error as UNEXPETED error
397 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
398 End validate_grid_datasource_name;
399
400 /*********************** END HAND-CODED ********************************/
401
402 ---------------------------------------------------------------------------
403 -- FUNCTION get_seq_id
404 ---------------------------------------------------------------------------
405 FUNCTION get_seq_id RETURN NUMBER IS
406
407 --
408 -- For non seeded (customer) data, ID should be 50000 or above
409 --
410 Cursor c Is
411 SELECT OKC_CLASS_OPERATIONS_S1.nextval
412 FROM dual;
413
414 --
415 -- For seeded data, ID should be greater than or equal to 11000 and less than 50000
416 --
417 Cursor cop_csr Is
418 SELECT
419 nvl(max(id), 11000) + 1
420 FROM
421 okc_class_operations_v
422 WHERE
423 ID >= 11000 AND id < 50000;
424
425 l_seq NUMBER;
426 BEGIN
427 if fnd_global.user_id = 1 then
428 open cop_csr;
429 fetch cop_csr into l_seq;
430 close cop_csr;
431 else
432 open c;
433 fetch c into l_seq;
434 close c;
435 end if;
436
437 RETURN (l_seq);
438
439 --RETURN(okc_p_util.raw_to_number(sys_guid()));
440 END get_seq_id;
441
442 ---------------------------------------------------------------------------
443 -- PROCEDURE qc
444 ---------------------------------------------------------------------------
445 PROCEDURE qc IS
446 BEGIN
447 null;
448 END qc;
449
450 ---------------------------------------------------------------------------
451 -- PROCEDURE change_version
452 ---------------------------------------------------------------------------
453 PROCEDURE change_version IS
454 BEGIN
455 null;
459 -- PROCEDURE api_copy
456 END change_version;
457
458 ---------------------------------------------------------------------------
460 ---------------------------------------------------------------------------
461 PROCEDURE api_copy IS
462 BEGIN
463 null;
464 END api_copy;
465
466 ---------------------------------------------------------------------------
467 -- FUNCTION get_rec for: OKC_CLASS_OPERATIONS
468 ---------------------------------------------------------------------------
469 FUNCTION get_rec (
470 p_cop_rec IN cop_rec_type,
471 x_no_data_found OUT NOCOPY BOOLEAN
472 ) RETURN cop_rec_type IS
473 CURSOR OKC_COP_pk_csr (p_id IN NUMBER) IS
474 SELECT
475 ID,
476 OPN_CODE,
477 CLS_CODE,
478 SEARCH_FUNCTION_ID,
479 DETAIL_FUNCTION_ID,
480 OBJECT_VERSION_NUMBER,
481 CREATED_BY,
482 CREATION_DATE,
483 LAST_UPDATED_BY,
484 LAST_UPDATE_DATE,
485 LAST_UPDATE_LOGIN,
486 PDF_ID,
487 grid_datasource_name,
488 QA_PDF_ID -- Bug# 2171059
489 FROM Okc_Class_Operations
490 WHERE okc_class_operations.id = p_id;
491 l_OKC_COP_pk OKC_COP_pk_csr%ROWTYPE;
492 l_cop_rec cop_rec_type;
493 BEGIN
494 x_no_data_found := TRUE;
495 -- Get current database values
496 OPEN OKC_COP_pk_csr (p_cop_rec.id);
497 FETCH OKC_COP_pk_csr INTO
498 l_cop_rec.ID,
499 l_cop_rec.OPN_CODE,
500 l_cop_rec.CLS_CODE,
501 l_cop_rec.SEARCH_FUNCTION_ID,
502 l_cop_rec.DETAIL_FUNCTION_ID,
503 l_cop_rec.OBJECT_VERSION_NUMBER,
504 l_cop_rec.CREATED_BY,
505 l_cop_rec.CREATION_DATE,
506 l_cop_rec.LAST_UPDATED_BY,
507 l_cop_rec.LAST_UPDATE_DATE,
508 l_cop_rec.LAST_UPDATE_LOGIN,
509 l_cop_rec.PDF_ID,
510 l_cop_rec.grid_datasource_name,
511 l_cop_rec.QA_PDF_ID; -- Bug# 2171059
512 x_no_data_found := OKC_COP_pk_csr%NOTFOUND;
513 CLOSE OKC_COP_pk_csr;
514 RETURN(l_cop_rec);
515 END get_rec;
516
517 FUNCTION get_rec (
518 p_cop_rec IN cop_rec_type
519 ) RETURN cop_rec_type IS
520 l_row_notfound BOOLEAN := TRUE;
521 BEGIN
522 RETURN(get_rec(p_cop_rec, l_row_notfound));
523 END get_rec;
524 ---------------------------------------------------------------------------
525 -- FUNCTION get_rec for: OKC_CLASS_OPERATIONS_V
526 ---------------------------------------------------------------------------
527 FUNCTION get_rec (
528 p_copv_rec IN copv_rec_type,
529 x_no_data_found OUT NOCOPY BOOLEAN
530 ) RETURN copv_rec_type IS
531 CURSOR OKC_COPv_pk_csr (p_id IN NUMBER) IS
532 SELECT
533 ID,
534 OPN_CODE,
535 CLS_CODE,
536 SEARCH_FUNCTION_ID,
537 DETAIL_FUNCTION_ID,
538 OBJECT_VERSION_NUMBER,
539 CREATED_BY,
540 CREATION_DATE,
541 LAST_UPDATED_BY,
542 LAST_UPDATE_DATE,
543 LAST_UPDATE_LOGIN,
544 PDF_ID,
545 grid_datasource_name,
546 QA_PDF_ID -- Bug# 2171059
547 FROM Okc_Class_Operations_V
548 WHERE okc_class_operations_v.id = p_id;
549 l_OKC_COPv_pk OKC_COPv_pk_csr%ROWTYPE;
550 l_copv_rec copv_rec_type;
551 BEGIN
552 x_no_data_found := TRUE;
553 -- Get current database values
554 OPEN OKC_COPv_pk_csr (p_copv_rec.id);
555 FETCH OKC_COPv_pk_csr INTO
556 l_copv_rec.ID,
557 l_copv_rec.OPN_CODE,
558 l_copv_rec.CLS_CODE,
559 l_copv_rec.SEARCH_FUNCTION_ID,
560 l_copv_rec.DETAIL_FUNCTION_ID,
561 l_copv_rec.OBJECT_VERSION_NUMBER,
562 l_copv_rec.CREATED_BY,
563 l_copv_rec.CREATION_DATE,
564 l_copv_rec.LAST_UPDATED_BY,
565 l_copv_rec.LAST_UPDATE_DATE,
566 l_copv_rec.LAST_UPDATE_LOGIN,
567 l_copv_rec.PDF_ID,
568 l_copv_rec.grid_datasource_name,
569 l_copv_rec.QA_PDF_ID; -- Bug# 2171059
570 x_no_data_found := OKC_COPv_pk_csr%NOTFOUND;
571 CLOSE OKC_COPv_pk_csr;
572 RETURN(l_copv_rec);
573 END get_rec;
574
575 FUNCTION get_rec (
576 p_copv_rec IN copv_rec_type
577 ) RETURN copv_rec_type IS
578 l_row_notfound BOOLEAN := TRUE;
579 BEGIN
580 RETURN(get_rec(p_copv_rec, l_row_notfound));
581 END get_rec;
582
583 ------------------------------------------------------------
584 -- FUNCTION null_out_defaults for: OKC_CLASS_OPERATIONS_V --
585 ------------------------------------------------------------
586 FUNCTION null_out_defaults (
587 p_copv_rec IN copv_rec_type
588 ) RETURN copv_rec_type IS
589 l_copv_rec copv_rec_type := p_copv_rec;
590 BEGIN
591 IF (l_copv_rec.opn_code = OKC_API.G_MISS_CHAR) THEN
592 l_copv_rec.opn_code := NULL;
593 END IF;
594 IF (l_copv_rec.cls_code = OKC_API.G_MISS_CHAR) THEN
595 l_copv_rec.cls_code := NULL;
596 END IF;
597 IF (l_copv_rec.search_function_id = OKC_API.G_MISS_NUM) THEN
601 l_copv_rec.detail_function_id := NULL;
598 l_copv_rec.search_function_id := NULL;
599 END IF;
600 IF (l_copv_rec.detail_function_id = OKC_API.G_MISS_NUM) THEN
602 END IF;
603 IF (l_copv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
604 l_copv_rec.object_version_number := NULL;
605 END IF;
606 IF (l_copv_rec.created_by = OKC_API.G_MISS_NUM) THEN
607 l_copv_rec.created_by := NULL;
608 END IF;
609 IF (l_copv_rec.creation_date = OKC_API.G_MISS_DATE) THEN
610 l_copv_rec.creation_date := NULL;
611 END IF;
612 IF (l_copv_rec.last_updated_by = OKC_API.G_MISS_NUM) THEN
613 l_copv_rec.last_updated_by := NULL;
614 END IF;
615 IF (l_copv_rec.last_update_date = OKC_API.G_MISS_DATE) THEN
616 l_copv_rec.last_update_date := NULL;
617 END IF;
618 IF (l_copv_rec.last_update_login = OKC_API.G_MISS_NUM) THEN
619 l_copv_rec.last_update_login := NULL;
620 END IF;
621 IF (l_copv_rec.pdf_id = OKC_API.G_MISS_NUM) THEN
622 l_copv_rec.pdf_id := NULL;
623 END IF;
624 IF (l_copv_rec.grid_datasource_name = OKC_API.G_MISS_CHAR) THEN
625 l_copv_rec.grid_datasource_name := NULL;
626 END IF;
627 IF (l_copv_rec.qa_pdf_id = OKC_API.G_MISS_NUM) THEN -- Bug# 2171059
628 l_copv_rec.qa_pdf_id := NULL;
629 END IF;
630 RETURN(l_copv_rec);
631 END null_out_defaults;
632 ---------------------------------------------------------------------------
633 -- PROCEDURE Validate_Attributes
634 ---------------------------------------------------------------------------
635 ----------------------------------------------------
636 -- Validate_Attributes for:OKC_CLASS_OPERATIONS_V --
637 ----------------------------------------------------
638 FUNCTION Validate_Attributes (
639 p_copv_rec IN copv_rec_type
640 ) RETURN VARCHAR2 IS
641 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
642 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
643 BEGIN
644 /************************ HAND-CODED *********************************/
645
646 validate_opn_code(x_return_status => l_return_status,
647 p_copv_rec => p_copv_rec);
648
649 -- store the highest degree of error
650 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
651 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
652 x_return_status := l_return_status;
653 End If;
654 End If;
655
656 validate_cls_code(x_return_status => l_return_status,
657 p_copv_rec => p_copv_rec);
658
659 -- store the highest degree of error
660 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
661 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
662 x_return_status := l_return_status;
663 End If;
664 End If;
665
666 validate_search_function_id(x_return_status => l_return_status,
667 p_copv_rec => p_copv_rec);
668
669 -- store the highest degree of error
670 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
671 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
672 x_return_status := l_return_status;
673 End If;
674 End If;
675
676 validate_detail_function_id(x_return_status => l_return_status,
677 p_copv_rec => p_copv_rec);
678
679 -- store the highest degree of error
680 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
681 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
682 x_return_status := l_return_status;
683 End If;
684 End If;
685
686 validate_pdf_id(x_return_status => l_return_status,
687 p_copv_rec => p_copv_rec);
688
689 -- store the highest degree of error
690 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
691 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
692 x_return_status := l_return_status;
693 End If;
694 End If;
695
696 -- added DEC 10, 2001
697 validate_grid_datasource_name(x_return_status => l_return_status,
698 p_copv_rec => p_copv_rec);
699
700 -- store the highest degree of error
701 If l_return_status <> OKC_API.G_RET_STS_SUCCESS Then
702 If x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
703 x_return_status := l_return_status;
704 End If;
705 End If;
706
707 RETURN(x_return_status);
708 EXCEPTION
709 when OTHERS then
710 -- store SQL error message on message stack
711 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
712 p_msg_name => g_unexpected_error,
713 p_token1 => g_sqlcode_token,
714 p_token1_value => sqlcode,
715 p_token2 => g_sqlerrm_token,
716 p_token2_value => sqlerrm);
717
718 -- notify caller of an UNEXPETED error
719 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
720
721 -- return status to caller
722 RETURN(x_return_status);
723
724 /*********************** END HAND-CODED ********************************/
725 END Validate_Attributes;
726
727 ---------------------------------------------------------------------------
728 -- PROCEDURE Validate_Record
729 ---------------------------------------------------------------------------
730 ------------------------------------------------
731 -- Validate_Record for:OKC_CLASS_OPERATIONS_V --
732 ------------------------------------------------
733 FUNCTION Validate_Record (
734 p_copv_rec IN copv_rec_type
735 ) RETURN VARCHAR2 IS
736 Cursor l_cop_csr Is
737 SELECT 'x'
741
738 FROM okc_class_operations
739 WHERE cls_code = p_copv_rec.cls_code
740 AND opn_code = p_copv_rec.opn_code;
742 l_dummy VARCHAR2(1);
743 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
744 BEGIN
745 -- Check for uniqueness for OPN_CODE + CLS_CODE
746 open l_cop_csr;
747 fetch l_cop_csr into l_dummy;
748 If (l_cop_csr%FOUND) Then
749 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
750 p_msg_name => 'OKC_CLS_OPN_CODES_NOT_UNIQUE');
751 l_return_status := OKC_API.G_RET_STS_ERROR;
752 End If;
753 close l_cop_csr;
754
755 RETURN (l_return_status);
756 EXCEPTION
757 when G_EXCEPTION_HALT_VALIDATION then
758 -- no processing necessary; validation can continue with next column
759 null;
760
761 when OTHERS then
762 -- store SQL error message on message stack
763 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
764 p_msg_name => g_unexpected_error,
765 p_token1 => g_sqlcode_token,
766 p_token1_value => sqlcode,
767 p_token2 => g_sqlerrm_token,
768 p_token2_value => sqlerrm);
769 -- notify caller of an error as UNEXPETED error
770 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
771 RETURN (l_return_status);
772 END Validate_Record;
773
774 ---------------------------------------------------------------------------
775 -- PROCEDURE Migrate
776 ---------------------------------------------------------------------------
777 PROCEDURE migrate (
778 p_from IN copv_rec_type,
779 p_to IN OUT NOCOPY cop_rec_type
780 ) IS
781 BEGIN
782 p_to.id := p_from.id;
783 p_to.opn_code := p_from.opn_code;
784 p_to.cls_code := p_from.cls_code;
785 p_to.search_function_id := p_from.search_function_id;
786 p_to.detail_function_id := p_from.detail_function_id;
787 p_to.object_version_number := p_from.object_version_number;
788 p_to.created_by := p_from.created_by;
789 p_to.creation_date := p_from.creation_date;
790 p_to.last_updated_by := p_from.last_updated_by;
791 p_to.last_update_date := p_from.last_update_date;
792 p_to.last_update_login := p_from.last_update_login;
793 p_to.pdf_id := p_from.pdf_id;
794 p_to.grid_datasource_name := p_from.grid_datasource_name;
795 p_to.qa_pdf_id := p_from.qa_pdf_id; -- Bug# 2171059
796 END migrate;
797 PROCEDURE migrate (
798 p_from IN cop_rec_type,
799 p_to IN OUT NOCOPY copv_rec_type
800 ) IS
801 BEGIN
802 p_to.id := p_from.id;
803 p_to.opn_code := p_from.opn_code;
804 p_to.cls_code := p_from.cls_code;
805 p_to.search_function_id := p_from.search_function_id;
806 p_to.detail_function_id := p_from.detail_function_id;
807 p_to.object_version_number := p_from.object_version_number;
808 p_to.created_by := p_from.created_by;
809 p_to.creation_date := p_from.creation_date;
810 p_to.last_updated_by := p_from.last_updated_by;
811 p_to.last_update_date := p_from.last_update_date;
812 p_to.last_update_login := p_from.last_update_login;
813 p_to.pdf_id := p_from.pdf_id;
814 p_to.grid_datasource_name := p_from.grid_datasource_name;
815 p_to.qa_pdf_id := p_from.qa_pdf_id; -- Bug# 2171059
816 END migrate;
817
818 ---------------------------------------------------------------------------
819 -- PROCEDURE validate_row
820 ---------------------------------------------------------------------------
821 ---------------------------------------------
822 -- validate_row for:OKC_CLASS_OPERATIONS_V --
823 ---------------------------------------------
824 PROCEDURE validate_row(
825 p_api_version IN NUMBER,
826 p_init_msg_list IN VARCHAR2 ,
827 x_return_status OUT NOCOPY VARCHAR2,
828 x_msg_count OUT NOCOPY NUMBER,
829 x_msg_data OUT NOCOPY VARCHAR2,
830 p_copv_rec IN copv_rec_type) IS
831
832 l_api_version CONSTANT NUMBER := 1;
833 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
834 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
835 l_copv_rec copv_rec_type := p_copv_rec;
836 l_cop_rec cop_rec_type;
837 BEGIN
838 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
839 G_PKG_NAME,
840 p_init_msg_list,
841 l_api_version,
842 p_api_version,
843 '_PVT',
844 x_return_status);
845 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
846 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
847 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
848 RAISE OKC_API.G_EXCEPTION_ERROR;
849 END IF;
850 --- Validate all non-missing attributes (Item Level Validation)
851 l_return_status := Validate_Attributes(l_copv_rec);
852 --- If any errors happen abort API
853 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
854 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
855 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
856 RAISE OKC_API.G_EXCEPTION_ERROR;
857 END IF;
858 l_return_status := Validate_Record(l_copv_rec);
862 RAISE OKC_API.G_EXCEPTION_ERROR;
859 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
860 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
861 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
863 END IF;
864 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
865 EXCEPTION
866 WHEN OKC_API.G_EXCEPTION_ERROR THEN
867 x_return_status := OKC_API.HANDLE_EXCEPTIONS
868 (
869 l_api_name,
870 G_PKG_NAME,
871 'OKC_API.G_RET_STS_ERROR',
872 x_msg_count,
873 x_msg_data,
874 '_PVT'
875 );
876 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
877 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
878 (
879 l_api_name,
880 G_PKG_NAME,
881 'OKC_API.G_RET_STS_UNEXP_ERROR',
882 x_msg_count,
883 x_msg_data,
884 '_PVT'
885 );
886 WHEN OTHERS THEN
887 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
888 (
889 l_api_name,
890 G_PKG_NAME,
891 'OTHERS',
892 x_msg_count,
893 x_msg_data,
894 '_PVT'
895 );
896 END validate_row;
897 -----------------------------------------
898 -- PL/SQL TBL validate_row for:copv_tbl --
899 -----------------------------------------
900 PROCEDURE validate_row(
901 p_api_version IN NUMBER,
902 p_init_msg_list IN VARCHAR2 ,
903 x_return_status OUT NOCOPY VARCHAR2,
904 x_msg_count OUT NOCOPY NUMBER,
905 x_msg_data OUT NOCOPY VARCHAR2,
906 p_copv_tbl IN copv_tbl_type) IS
907
908 l_api_version CONSTANT NUMBER := 1;
909 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
910 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
911 i NUMBER := 0;
912 BEGIN
913 OKC_API.init_msg_list(p_init_msg_list);
914 -- Make sure PL/SQL table has records in it before passing
915 IF (p_copv_tbl.COUNT > 0) THEN
916 i := p_copv_tbl.FIRST;
917 LOOP
918 validate_row (
919 p_api_version => p_api_version,
920 p_init_msg_list => OKC_API.G_FALSE,
921 x_return_status => x_return_status,
922 x_msg_count => x_msg_count,
923 x_msg_data => x_msg_data,
924 p_copv_rec => p_copv_tbl(i));
925 EXIT WHEN (i = p_copv_tbl.LAST);
926 i := p_copv_tbl.NEXT(i);
927 END LOOP;
928 END IF;
929 EXCEPTION
930 WHEN OKC_API.G_EXCEPTION_ERROR THEN
931 x_return_status := OKC_API.HANDLE_EXCEPTIONS
932 (
933 l_api_name,
934 G_PKG_NAME,
935 'OKC_API.G_RET_STS_ERROR',
936 x_msg_count,
937 x_msg_data,
938 '_PVT'
939 );
940 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
941 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
942 (
943 l_api_name,
944 G_PKG_NAME,
945 'OKC_API.G_RET_STS_UNEXP_ERROR',
946 x_msg_count,
947 x_msg_data,
948 '_PVT'
949 );
950 WHEN OTHERS THEN
951 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
952 (
953 l_api_name,
954 G_PKG_NAME,
955 'OTHERS',
956 x_msg_count,
957 x_msg_data,
958 '_PVT'
959 );
960 END validate_row;
961
962 ---------------------------------------------------------------------------
963 -- PROCEDURE insert_row
964 ---------------------------------------------------------------------------
965 -----------------------------------------
966 -- insert_row for:OKC_CLASS_OPERATIONS --
967 -----------------------------------------
968 PROCEDURE insert_row(
969 p_init_msg_list IN VARCHAR2 ,
970 x_return_status OUT NOCOPY VARCHAR2,
971 x_msg_count OUT NOCOPY NUMBER,
972 x_msg_data OUT NOCOPY VARCHAR2,
973 p_cop_rec IN cop_rec_type,
974 x_cop_rec OUT NOCOPY cop_rec_type) IS
975
976 l_api_version CONSTANT NUMBER := 1;
977 l_api_name CONSTANT VARCHAR2(30) := 'OPERATIONS_insert_row';
978 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
979 l_cop_rec cop_rec_type := p_cop_rec;
980 l_def_cop_rec cop_rec_type;
981 ---------------------------------------------
982 -- Set_Attributes for:OKC_CLASS_OPERATIONS --
983 ---------------------------------------------
984 FUNCTION Set_Attributes (
985 p_cop_rec IN cop_rec_type,
986 x_cop_rec OUT NOCOPY cop_rec_type
987 ) RETURN VARCHAR2 IS
988 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
989 BEGIN
990 x_cop_rec := p_cop_rec;
991 RETURN(l_return_status);
992 END Set_Attributes;
993 BEGIN
994 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
995 p_init_msg_list,
996 '_PVT',
997 x_return_status);
998 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1002 END IF;
999 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1000 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1001 RAISE OKC_API.G_EXCEPTION_ERROR;
1003 --- Setting item attributes
1004 l_return_status := Set_Attributes(
1005 p_cop_rec, -- IN
1006 l_cop_rec); -- OUT
1007 --- If any errors happen abort API
1008 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1009 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1010 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1011 RAISE OKC_API.G_EXCEPTION_ERROR;
1012 END IF;
1013 INSERT INTO OKC_CLASS_OPERATIONS(
1014 id,
1015 opn_code,
1016 cls_code,
1017 search_function_id,
1018 detail_function_id,
1019 object_version_number,
1020 created_by,
1021 creation_date,
1022 last_updated_by,
1023 last_update_date,
1024 last_update_login,
1025 pdf_id,
1026 grid_datasource_name,
1027 qa_pdf_id ) -- Bug# 2171059
1028 VALUES (
1029 l_cop_rec.id,
1030 l_cop_rec.opn_code,
1031 l_cop_rec.cls_code,
1032 l_cop_rec.search_function_id,
1033 l_cop_rec.detail_function_id,
1034 l_cop_rec.object_version_number,
1035 l_cop_rec.created_by,
1036 l_cop_rec.creation_date,
1037 l_cop_rec.last_updated_by,
1038 l_cop_rec.last_update_date,
1039 l_cop_rec.last_update_login,
1040 l_cop_rec.pdf_id,
1041 l_cop_rec.grid_datasource_name,
1042 l_cop_rec.qa_pdf_id ); -- Bug# 2171059
1043 -- Set OUT values
1044 x_cop_rec := l_cop_rec;
1045 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1046 EXCEPTION
1047 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1048 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1049 (
1050 l_api_name,
1051 G_PKG_NAME,
1052 'OKC_API.G_RET_STS_ERROR',
1053 x_msg_count,
1054 x_msg_data,
1055 '_PVT'
1056 );
1057 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1058 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1059 (
1060 l_api_name,
1061 G_PKG_NAME,
1062 'OKC_API.G_RET_STS_UNEXP_ERROR',
1063 x_msg_count,
1064 x_msg_data,
1065 '_PVT'
1066 );
1067 WHEN OTHERS THEN
1068 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1069 (
1070 l_api_name,
1071 G_PKG_NAME,
1072 'OTHERS',
1073 x_msg_count,
1074 x_msg_data,
1075 '_PVT'
1076 );
1077 END insert_row;
1078 -------------------------------------------
1079 -- insert_row for:OKC_CLASS_OPERATIONS_V --
1080 -------------------------------------------
1081 PROCEDURE insert_row(
1082 p_api_version IN NUMBER,
1083 p_init_msg_list IN VARCHAR2 ,
1084 x_return_status OUT NOCOPY VARCHAR2,
1085 x_msg_count OUT NOCOPY NUMBER,
1086 x_msg_data OUT NOCOPY VARCHAR2,
1087 p_copv_rec IN copv_rec_type,
1088 x_copv_rec OUT NOCOPY copv_rec_type) IS
1089
1090 l_api_version CONSTANT NUMBER := 1;
1091 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
1092 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1093 l_copv_rec copv_rec_type;
1094 l_def_copv_rec copv_rec_type;
1095 l_cop_rec cop_rec_type;
1096 lx_cop_rec cop_rec_type;
1097 -------------------------------
1098 -- FUNCTION fill_who_columns --
1099 -------------------------------
1100 FUNCTION fill_who_columns (
1101 p_copv_rec IN copv_rec_type
1102 ) RETURN copv_rec_type IS
1103 l_copv_rec copv_rec_type := p_copv_rec;
1104 BEGIN
1105 l_copv_rec.CREATION_DATE := SYSDATE;
1106 l_copv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
1107 l_copv_rec.LAST_UPDATE_DATE := l_copv_rec.CREATION_DATE;
1108 l_copv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1109 l_copv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1110 RETURN(l_copv_rec);
1111 END fill_who_columns;
1112 -----------------------------------------------
1113 -- Set_Attributes for:OKC_CLASS_OPERATIONS_V --
1114 -----------------------------------------------
1115 FUNCTION Set_Attributes (
1116 p_copv_rec IN copv_rec_type,
1117 x_copv_rec OUT NOCOPY copv_rec_type
1118 ) RETURN VARCHAR2 IS
1119 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1120 BEGIN
1121 x_copv_rec := p_copv_rec;
1122 x_copv_rec.OBJECT_VERSION_NUMBER := 10000;
1123 RETURN(l_return_status);
1124 END Set_Attributes;
1125 BEGIN
1126 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1127 G_PKG_NAME,
1128 p_init_msg_list,
1129 l_api_version,
1130 p_api_version,
1131 '_PVT',
1132 x_return_status);
1133 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1134 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1135 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1136 RAISE OKC_API.G_EXCEPTION_ERROR;
1137 END IF;
1138 l_copv_rec := null_out_defaults(p_copv_rec);
1139 -- Set primary key value
1140 l_copv_rec.ID := get_seq_id;
1144 l_def_copv_rec); -- OUT
1141 --- Setting item attributes
1142 l_return_status := Set_Attributes(
1143 l_copv_rec, -- IN
1145 --- If any errors happen abort API
1146 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1147 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1148 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1149 RAISE OKC_API.G_EXCEPTION_ERROR;
1150 END IF;
1151 l_def_copv_rec := fill_who_columns(l_def_copv_rec);
1152 --- Validate all non-missing attributes (Item Level Validation)
1153 l_return_status := Validate_Attributes(l_def_copv_rec);
1154 --- If any errors happen abort API
1155 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1156 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1157 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1158 RAISE OKC_API.G_EXCEPTION_ERROR;
1159 END IF;
1160 l_return_status := Validate_Record(l_def_copv_rec);
1161 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1162 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1163 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1164 RAISE OKC_API.G_EXCEPTION_ERROR;
1165 END IF;
1166 --------------------------------------
1167 -- Move VIEW record to "Child" records
1168 --------------------------------------
1169 migrate(l_def_copv_rec, l_cop_rec);
1170 --------------------------------------------
1171 -- Call the INSERT_ROW for each child record
1172 --------------------------------------------
1173 insert_row(
1174 p_init_msg_list,
1175 x_return_status,
1176 x_msg_count,
1177 x_msg_data,
1178 l_cop_rec,
1179 lx_cop_rec
1180 );
1181 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1182 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1183 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1184 RAISE OKC_API.G_EXCEPTION_ERROR;
1185 END IF;
1186 migrate(lx_cop_rec, l_def_copv_rec);
1187 -- Set OUT values
1188 x_copv_rec := l_def_copv_rec;
1189 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1190 EXCEPTION
1191 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1192 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1193 (
1194 l_api_name,
1195 G_PKG_NAME,
1196 'OKC_API.G_RET_STS_ERROR',
1197 x_msg_count,
1198 x_msg_data,
1199 '_PVT'
1200 );
1201 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1202 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1203 (
1204 l_api_name,
1205 G_PKG_NAME,
1206 'OKC_API.G_RET_STS_UNEXP_ERROR',
1207 x_msg_count,
1208 x_msg_data,
1209 '_PVT'
1210 );
1211 WHEN OTHERS THEN
1212 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1213 (
1214 l_api_name,
1215 G_PKG_NAME,
1216 'OTHERS',
1217 x_msg_count,
1218 x_msg_data,
1219 '_PVT'
1220 );
1221 END insert_row;
1222 ---------------------------------------
1223 -- PL/SQL TBL insert_row for:copv_tbl --
1224 ---------------------------------------
1225 PROCEDURE insert_row(
1226 p_api_version IN NUMBER,
1227 p_init_msg_list IN VARCHAR2 ,
1228 x_return_status OUT NOCOPY VARCHAR2,
1229 x_msg_count OUT NOCOPY NUMBER,
1230 x_msg_data OUT NOCOPY VARCHAR2,
1231 p_copv_tbl IN copv_tbl_type,
1232 x_copv_tbl OUT NOCOPY copv_tbl_type) IS
1233
1234 l_api_version CONSTANT NUMBER := 1;
1235 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1236 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1237 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1238 i NUMBER := 0;
1239 BEGIN
1240 OKC_API.init_msg_list(p_init_msg_list);
1241 -- Make sure PL/SQL table has records in it before passing
1242 IF (p_copv_tbl.COUNT > 0) THEN
1243 i := p_copv_tbl.FIRST;
1244 LOOP
1245 insert_row (
1246 p_api_version => p_api_version,
1247 p_init_msg_list => OKC_API.G_FALSE,
1248 x_return_status => x_return_status,
1249 x_msg_count => x_msg_count,
1250 x_msg_data => x_msg_data,
1251 p_copv_rec => p_copv_tbl(i),
1252 x_copv_rec => x_copv_tbl(i));
1253
1254 -- store the highest degree of error
1255 If x_return_status <> OKC_API.G_RET_STS_SUCCESS Then
1256 If l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
1257 l_overall_status := x_return_status;
1258 End If;
1259 End If;
1260
1261 EXIT WHEN (i = p_copv_tbl.LAST);
1262 i := p_copv_tbl.NEXT(i);
1263 END LOOP;
1264 -- return overall status
1265 x_return_status := l_overall_status;
1266 END IF;
1267 EXCEPTION
1268 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1269 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1270 (
1271 l_api_name,
1272 G_PKG_NAME,
1273 'OKC_API.G_RET_STS_ERROR',
1274 x_msg_count,
1275 x_msg_data,
1276 '_PVT'
1277 );
1278 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1279 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1280 (
1281 l_api_name,
1282 G_PKG_NAME,
1283 'OKC_API.G_RET_STS_UNEXP_ERROR',
1287 );
1284 x_msg_count,
1285 x_msg_data,
1286 '_PVT'
1288 WHEN OTHERS THEN
1289 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1290 (
1291 l_api_name,
1292 G_PKG_NAME,
1293 'OTHERS',
1294 x_msg_count,
1295 x_msg_data,
1296 '_PVT'
1297 );
1298 END insert_row;
1299
1300 ---------------------------------------------------------------------------
1301 -- PROCEDURE lock_row
1302 ---------------------------------------------------------------------------
1303 ---------------------------------------
1304 -- lock_row for:OKC_CLASS_OPERATIONS --
1305 ---------------------------------------
1306 PROCEDURE lock_row(
1307 p_init_msg_list IN VARCHAR2 ,
1308 x_return_status OUT NOCOPY VARCHAR2,
1309 x_msg_count OUT NOCOPY NUMBER,
1310 x_msg_data OUT NOCOPY VARCHAR2,
1311 p_cop_rec IN cop_rec_type) IS
1312
1313 E_Resource_Busy EXCEPTION;
1314 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
1315 CURSOR lock_csr (p_cop_rec IN cop_rec_type) IS
1316 SELECT OBJECT_VERSION_NUMBER
1317 FROM OKC_CLASS_OPERATIONS
1318 WHERE ID = p_cop_rec.id
1319 AND OBJECT_VERSION_NUMBER = p_cop_rec.object_version_number
1320 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
1321
1322 CURSOR lchk_csr (p_cop_rec IN cop_rec_type) IS
1323 SELECT OBJECT_VERSION_NUMBER
1324 FROM OKC_CLASS_OPERATIONS
1325 WHERE ID = p_cop_rec.id;
1326 l_api_version CONSTANT NUMBER := 1;
1327 l_api_name CONSTANT VARCHAR2(30) := 'OPERATIONS_lock_row';
1328 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1329 l_object_version_number OKC_CLASS_OPERATIONS.OBJECT_VERSION_NUMBER%TYPE;
1330 lc_object_version_number OKC_CLASS_OPERATIONS.OBJECT_VERSION_NUMBER%TYPE;
1331 l_row_notfound BOOLEAN := FALSE;
1332 lc_row_notfound BOOLEAN := FALSE;
1333 BEGIN
1334 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1335 p_init_msg_list,
1336 '_PVT',
1337 x_return_status);
1338 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1339 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1340 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1341 RAISE OKC_API.G_EXCEPTION_ERROR;
1342 END IF;
1343 BEGIN
1344 OPEN lock_csr(p_cop_rec);
1345 FETCH lock_csr INTO l_object_version_number;
1346 l_row_notfound := lock_csr%NOTFOUND;
1347 CLOSE lock_csr;
1348 EXCEPTION
1349 WHEN E_Resource_Busy THEN
1350 IF (lock_csr%ISOPEN) THEN
1351 CLOSE lock_csr;
1352 END IF;
1353 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
1354 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
1355 END;
1356
1357 IF ( l_row_notfound ) THEN
1358 OPEN lchk_csr(p_cop_rec);
1359 FETCH lchk_csr INTO lc_object_version_number;
1360 lc_row_notfound := lchk_csr%NOTFOUND;
1361 CLOSE lchk_csr;
1362 END IF;
1363 IF (lc_row_notfound) THEN
1364 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1365 RAISE OKC_API.G_EXCEPTION_ERROR;
1366 ELSIF lc_object_version_number > p_cop_rec.object_version_number THEN
1367 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1368 RAISE OKC_API.G_EXCEPTION_ERROR;
1369 ELSIF lc_object_version_number <> p_cop_rec.object_version_number THEN
1370 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1371 RAISE OKC_API.G_EXCEPTION_ERROR;
1372 ELSIF lc_object_version_number = -1 THEN
1373 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1374 RAISE OKC_API.G_EXCEPTION_ERROR;
1375 END IF;
1376 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1377 EXCEPTION
1378 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1379 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1380 (
1381 l_api_name,
1382 G_PKG_NAME,
1383 'OKC_API.G_RET_STS_ERROR',
1384 x_msg_count,
1385 x_msg_data,
1386 '_PVT'
1387 );
1388 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1389 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1390 (
1391 l_api_name,
1392 G_PKG_NAME,
1393 'OKC_API.G_RET_STS_UNEXP_ERROR',
1394 x_msg_count,
1395 x_msg_data,
1396 '_PVT'
1397 );
1398 WHEN OTHERS THEN
1399 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1400 (
1401 l_api_name,
1402 G_PKG_NAME,
1403 'OTHERS',
1404 x_msg_count,
1405 x_msg_data,
1406 '_PVT'
1407 );
1408 END lock_row;
1409 -----------------------------------------
1410 -- lock_row for:OKC_CLASS_OPERATIONS_V --
1411 -----------------------------------------
1412 PROCEDURE lock_row(
1413 p_api_version IN NUMBER,
1414 p_init_msg_list IN VARCHAR2 ,
1415 x_return_status OUT NOCOPY VARCHAR2,
1416 x_msg_count OUT NOCOPY NUMBER,
1417 x_msg_data OUT NOCOPY VARCHAR2,
1418 p_copv_rec IN copv_rec_type) IS
1419
1420 l_api_version CONSTANT NUMBER := 1;
1421 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
1422 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1423 l_cop_rec cop_rec_type;
1424 BEGIN
1428 l_api_version,
1425 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1426 G_PKG_NAME,
1427 p_init_msg_list,
1429 p_api_version,
1430 '_PVT',
1431 x_return_status);
1432 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1433 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1434 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1435 RAISE OKC_API.G_EXCEPTION_ERROR;
1436 END IF;
1437 --------------------------------------
1438 -- Move VIEW record to "Child" records
1439 --------------------------------------
1440 migrate(p_copv_rec, l_cop_rec);
1441 --------------------------------------------
1442 -- Call the LOCK_ROW for each child record
1443 --------------------------------------------
1444 lock_row(
1445 p_init_msg_list,
1446 x_return_status,
1447 x_msg_count,
1448 x_msg_data,
1449 l_cop_rec
1450 );
1451 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1452 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1453 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1454 RAISE OKC_API.G_EXCEPTION_ERROR;
1455 END IF;
1456 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1457 EXCEPTION
1458 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1459 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1460 (
1461 l_api_name,
1462 G_PKG_NAME,
1463 'OKC_API.G_RET_STS_ERROR',
1464 x_msg_count,
1465 x_msg_data,
1466 '_PVT'
1467 );
1468 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1469 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1470 (
1471 l_api_name,
1472 G_PKG_NAME,
1473 'OKC_API.G_RET_STS_UNEXP_ERROR',
1474 x_msg_count,
1475 x_msg_data,
1476 '_PVT'
1477 );
1478 WHEN OTHERS THEN
1479 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1480 (
1481 l_api_name,
1482 G_PKG_NAME,
1483 'OTHERS',
1484 x_msg_count,
1485 x_msg_data,
1486 '_PVT'
1487 );
1488 END lock_row;
1489 -------------------------------------
1490 -- PL/SQL TBL lock_row for:copv_tbl --
1491 -------------------------------------
1492 PROCEDURE lock_row(
1493 p_api_version IN NUMBER,
1494 p_init_msg_list IN VARCHAR2 ,
1495 x_return_status OUT NOCOPY VARCHAR2,
1496 x_msg_count OUT NOCOPY NUMBER,
1497 x_msg_data OUT NOCOPY VARCHAR2,
1498 p_copv_tbl IN copv_tbl_type) IS
1499
1500 l_api_version CONSTANT NUMBER := 1;
1501 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
1502 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1503 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1504 i NUMBER := 0;
1505 BEGIN
1506 OKC_API.init_msg_list(p_init_msg_list);
1507 -- Make sure PL/SQL table has records in it before passing
1508 IF (p_copv_tbl.COUNT > 0) THEN
1509 i := p_copv_tbl.FIRST;
1510 LOOP
1511 lock_row (
1512 p_api_version => p_api_version,
1513 p_init_msg_list => OKC_API.G_FALSE,
1514 x_return_status => x_return_status,
1515 x_msg_count => x_msg_count,
1516 x_msg_data => x_msg_data,
1517 p_copv_rec => p_copv_tbl(i));
1518
1519 -- store the highest degree of error
1520 If x_return_status <> OKC_API.G_RET_STS_SUCCESS Then
1521 If l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
1522 l_overall_status := x_return_status;
1523 End If;
1524 End If;
1525
1526 EXIT WHEN (i = p_copv_tbl.LAST);
1527 i := p_copv_tbl.NEXT(i);
1528 END LOOP;
1529 -- return overall status
1530 x_return_status := l_overall_status;
1531 END IF;
1532 EXCEPTION
1533 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1534 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1535 (
1536 l_api_name,
1537 G_PKG_NAME,
1538 'OKC_API.G_RET_STS_ERROR',
1539 x_msg_count,
1540 x_msg_data,
1541 '_PVT'
1542 );
1543 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1544 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1545 (
1546 l_api_name,
1547 G_PKG_NAME,
1548 'OKC_API.G_RET_STS_UNEXP_ERROR',
1549 x_msg_count,
1550 x_msg_data,
1551 '_PVT'
1552 );
1553 WHEN OTHERS THEN
1554 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1555 (
1556 l_api_name,
1557 G_PKG_NAME,
1558 'OTHERS',
1559 x_msg_count,
1560 x_msg_data,
1561 '_PVT'
1562 );
1563 END lock_row;
1564
1565 ---------------------------------------------------------------------------
1566 -- PROCEDURE update_row
1567 ---------------------------------------------------------------------------
1568 -----------------------------------------
1569 -- update_row for:OKC_CLASS_OPERATIONS --
1570 -----------------------------------------
1571 PROCEDURE update_row(
1575 x_msg_data OUT NOCOPY VARCHAR2,
1572 p_init_msg_list IN VARCHAR2 ,
1573 x_return_status OUT NOCOPY VARCHAR2,
1574 x_msg_count OUT NOCOPY NUMBER,
1576 p_cop_rec IN cop_rec_type,
1577 x_cop_rec OUT NOCOPY cop_rec_type) IS
1578
1579 l_api_version CONSTANT NUMBER := 1;
1580 l_api_name CONSTANT VARCHAR2(30) := 'OPERATIONS_update_row';
1581 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1582 l_cop_rec cop_rec_type := p_cop_rec;
1583 l_def_cop_rec cop_rec_type;
1584 l_row_notfound BOOLEAN := TRUE;
1585 ----------------------------------
1586 -- FUNCTION populate_new_record --
1587 ----------------------------------
1588 FUNCTION populate_new_record (
1589 p_cop_rec IN cop_rec_type,
1590 x_cop_rec OUT NOCOPY cop_rec_type
1591 ) RETURN VARCHAR2 IS
1592 l_cop_rec cop_rec_type;
1593 l_row_notfound BOOLEAN := TRUE;
1594 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1595 BEGIN
1596 x_cop_rec := p_cop_rec;
1597 -- Get current database values
1598 l_cop_rec := get_rec(p_cop_rec, l_row_notfound);
1599 IF (l_row_notfound) THEN
1600 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1601 END IF;
1602 IF (x_cop_rec.id = OKC_API.G_MISS_NUM)
1603 THEN
1604 x_cop_rec.id := l_cop_rec.id;
1605 END IF;
1606 IF (x_cop_rec.opn_code = OKC_API.G_MISS_CHAR)
1607 THEN
1608 x_cop_rec.opn_code := l_cop_rec.opn_code;
1609 END IF;
1610 IF (x_cop_rec.cls_code = OKC_API.G_MISS_CHAR)
1611 THEN
1612 x_cop_rec.cls_code := l_cop_rec.cls_code;
1613 END IF;
1614 IF (x_cop_rec.search_function_id = OKC_API.G_MISS_NUM)
1615 THEN
1616 x_cop_rec.search_function_id := l_cop_rec.search_function_id;
1617 END IF;
1618 IF (x_cop_rec.detail_function_id = OKC_API.G_MISS_NUM)
1619 THEN
1620 x_cop_rec.detail_function_id := l_cop_rec.detail_function_id;
1621 END IF;
1622 IF (x_cop_rec.object_version_number = OKC_API.G_MISS_NUM)
1623 THEN
1624 x_cop_rec.object_version_number := l_cop_rec.object_version_number;
1625 END IF;
1626 IF (x_cop_rec.created_by = OKC_API.G_MISS_NUM)
1627 THEN
1628 x_cop_rec.created_by := l_cop_rec.created_by;
1629 END IF;
1630 IF (x_cop_rec.creation_date = OKC_API.G_MISS_DATE)
1631 THEN
1632 x_cop_rec.creation_date := l_cop_rec.creation_date;
1633 END IF;
1634 IF (x_cop_rec.last_updated_by = OKC_API.G_MISS_NUM)
1635 THEN
1636 x_cop_rec.last_updated_by := l_cop_rec.last_updated_by;
1637 END IF;
1638 IF (x_cop_rec.last_update_date = OKC_API.G_MISS_DATE)
1639 THEN
1640 x_cop_rec.last_update_date := l_cop_rec.last_update_date;
1641 END IF;
1642 IF (x_cop_rec.last_update_login = OKC_API.G_MISS_NUM)
1643 THEN
1644 x_cop_rec.last_update_login := l_cop_rec.last_update_login;
1645 END IF;
1646 IF (x_cop_rec.pdf_id = OKC_API.G_MISS_NUM)
1647 THEN
1648 x_cop_rec.pdf_id := l_cop_rec.pdf_id;
1649 END IF;
1650 IF (x_cop_rec.grid_datasource_name = OKC_API.G_MISS_CHAR)
1651 THEN
1652 x_cop_rec.grid_datasource_name := l_cop_rec.grid_datasource_name;
1653 END IF;
1654 IF (x_cop_rec.qa_pdf_id = OKC_API.G_MISS_NUM) -- Bug# 2171059
1655 THEN
1656 x_cop_rec.qa_pdf_id := l_cop_rec.qa_pdf_id;
1657 END IF;
1658
1659 RETURN(l_return_status);
1660 END populate_new_record;
1661 ---------------------------------------------
1662 -- Set_Attributes for:OKC_CLASS_OPERATIONS --
1663 ---------------------------------------------
1664 FUNCTION Set_Attributes (
1665 p_cop_rec IN cop_rec_type,
1666 x_cop_rec OUT NOCOPY cop_rec_type
1667 ) RETURN VARCHAR2 IS
1668 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1669 BEGIN
1670 x_cop_rec := p_cop_rec;
1671 RETURN(l_return_status);
1672 END Set_Attributes;
1673 BEGIN
1674 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1675 p_init_msg_list,
1676 '_PVT',
1677 x_return_status);
1678 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1679 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1680 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1681 RAISE OKC_API.G_EXCEPTION_ERROR;
1682 END IF;
1683 --- Setting item attributes
1684 l_return_status := Set_Attributes(
1685 p_cop_rec, -- IN
1686 l_cop_rec); -- OUT
1687 --- If any errors happen abort API
1688 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1689 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1690 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1691 RAISE OKC_API.G_EXCEPTION_ERROR;
1692 END IF;
1693 l_return_status := populate_new_record(l_cop_rec, l_def_cop_rec);
1694 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1695 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1696 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1697 RAISE OKC_API.G_EXCEPTION_ERROR;
1698 END IF;
1699 UPDATE OKC_CLASS_OPERATIONS
1700 SET OPN_CODE = l_def_cop_rec.opn_code,
1704 OBJECT_VERSION_NUMBER = l_def_cop_rec.object_version_number,
1701 CLS_CODE = l_def_cop_rec.cls_code,
1702 SEARCH_FUNCTION_ID = l_def_cop_rec.search_function_id,
1703 DETAIL_FUNCTION_ID = l_def_cop_rec.detail_function_id,
1705 CREATED_BY = l_def_cop_rec.created_by,
1706 CREATION_DATE = l_def_cop_rec.creation_date,
1707 LAST_UPDATED_BY = l_def_cop_rec.last_updated_by,
1708 LAST_UPDATE_DATE = l_def_cop_rec.last_update_date,
1709 LAST_UPDATE_LOGIN = l_def_cop_rec.last_update_login,
1710 PDF_ID = l_def_cop_rec.pdf_id,
1711 grid_datasource_name = l_def_cop_rec.grid_datasource_name,
1712 QA_PDF_ID = l_def_cop_rec.qa_pdf_id -- Bug# 2171059
1713 WHERE ID = l_def_cop_rec.id;
1714
1715 x_cop_rec := l_def_cop_rec;
1716 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1717 EXCEPTION
1718 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1719 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1720 (
1721 l_api_name,
1722 G_PKG_NAME,
1723 'OKC_API.G_RET_STS_ERROR',
1724 x_msg_count,
1725 x_msg_data,
1726 '_PVT'
1727 );
1728 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1729 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1730 (
1731 l_api_name,
1732 G_PKG_NAME,
1733 'OKC_API.G_RET_STS_UNEXP_ERROR',
1734 x_msg_count,
1735 x_msg_data,
1736 '_PVT'
1737 );
1738 WHEN OTHERS THEN
1739 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1740 (
1741 l_api_name,
1742 G_PKG_NAME,
1743 'OTHERS',
1744 x_msg_count,
1745 x_msg_data,
1746 '_PVT'
1747 );
1748 END update_row;
1749 -------------------------------------------
1750 -- update_row for:OKC_CLASS_OPERATIONS_V --
1751 -------------------------------------------
1752 PROCEDURE update_row(
1753 p_api_version IN NUMBER,
1754 p_init_msg_list IN VARCHAR2 ,
1755 x_return_status OUT NOCOPY VARCHAR2,
1756 x_msg_count OUT NOCOPY NUMBER,
1757 x_msg_data OUT NOCOPY VARCHAR2,
1758 p_copv_rec IN copv_rec_type,
1759 x_copv_rec OUT NOCOPY copv_rec_type) IS
1760
1761 l_api_version CONSTANT NUMBER := 1;
1762 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
1763 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1764 l_copv_rec copv_rec_type := p_copv_rec;
1765 l_def_copv_rec copv_rec_type;
1766 l_cop_rec cop_rec_type;
1767 lx_cop_rec cop_rec_type;
1768 -------------------------------
1769 -- FUNCTION fill_who_columns --
1770 -------------------------------
1771 FUNCTION fill_who_columns (
1772 p_copv_rec IN copv_rec_type
1773 ) RETURN copv_rec_type IS
1774 l_copv_rec copv_rec_type := p_copv_rec;
1775 BEGIN
1776 l_copv_rec.LAST_UPDATE_DATE := SYSDATE;
1777 l_copv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1778 l_copv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1779 RETURN(l_copv_rec);
1780 END fill_who_columns;
1781 ----------------------------------
1782 -- FUNCTION populate_new_record --
1783 ----------------------------------
1784 FUNCTION populate_new_record (
1785 p_copv_rec IN copv_rec_type,
1786 x_copv_rec OUT NOCOPY copv_rec_type
1787 ) RETURN VARCHAR2 IS
1788 l_copv_rec copv_rec_type;
1789 l_row_notfound BOOLEAN := TRUE;
1790 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1791 BEGIN
1792 x_copv_rec := p_copv_rec;
1793 -- Get current database values
1794 l_copv_rec := get_rec(p_copv_rec, l_row_notfound);
1795 IF (l_row_notfound) THEN
1796 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1797 END IF;
1798 IF (x_copv_rec.id = OKC_API.G_MISS_NUM)
1799 THEN
1800 x_copv_rec.id := l_copv_rec.id;
1801 END IF;
1802 IF (x_copv_rec.opn_code = OKC_API.G_MISS_CHAR)
1803 THEN
1804 x_copv_rec.opn_code := l_copv_rec.opn_code;
1805 END IF;
1806 IF (x_copv_rec.cls_code = OKC_API.G_MISS_CHAR)
1807 THEN
1808 x_copv_rec.cls_code := l_copv_rec.cls_code;
1809 END IF;
1810 IF (x_copv_rec.search_function_id = OKC_API.G_MISS_NUM)
1811 THEN
1812 x_copv_rec.search_function_id := l_copv_rec.search_function_id;
1813 END IF;
1814 IF (x_copv_rec.detail_function_id = OKC_API.G_MISS_NUM)
1815 THEN
1816 x_copv_rec.detail_function_id := l_copv_rec.detail_function_id;
1817 END IF;
1818 IF (x_copv_rec.object_version_number = OKC_API.G_MISS_NUM)
1819 THEN
1820 x_copv_rec.object_version_number := l_copv_rec.object_version_number;
1821 END IF;
1822 IF (x_copv_rec.created_by = OKC_API.G_MISS_NUM)
1823 THEN
1824 x_copv_rec.created_by := l_copv_rec.created_by;
1825 END IF;
1826 IF (x_copv_rec.creation_date = OKC_API.G_MISS_DATE)
1827 THEN
1828 x_copv_rec.creation_date := l_copv_rec.creation_date;
1829 END IF;
1830 IF (x_copv_rec.last_updated_by = OKC_API.G_MISS_NUM)
1831 THEN
1832 x_copv_rec.last_updated_by := l_copv_rec.last_updated_by;
1833 END IF;
1837 END IF;
1834 IF (x_copv_rec.last_update_date = OKC_API.G_MISS_DATE)
1835 THEN
1836 x_copv_rec.last_update_date := l_copv_rec.last_update_date;
1838 IF (x_copv_rec.last_update_login = OKC_API.G_MISS_NUM)
1839 THEN
1840 x_copv_rec.last_update_login := l_copv_rec.last_update_login;
1841 END IF;
1842 IF (x_copv_rec.pdf_id = OKC_API.G_MISS_NUM)
1843 THEN
1844 x_copv_rec.pdf_id := l_copv_rec.pdf_id;
1845 END IF;
1846 IF (x_copv_rec.grid_datasource_name = OKC_API.G_MISS_CHAR)
1847 THEN
1848 x_copv_rec.grid_datasource_name := l_copv_rec.grid_datasource_name;
1849 END IF;
1850 IF (x_copv_rec.qa_pdf_id = OKC_API.G_MISS_NUM) -- Bug# 2171059
1851 THEN
1852 x_copv_rec.qa_pdf_id := l_copv_rec.qa_pdf_id;
1853 END IF;
1854 RETURN(l_return_status);
1855 END populate_new_record;
1856 -----------------------------------------------
1857 -- Set_Attributes for:OKC_CLASS_OPERATIONS_V --
1858 -----------------------------------------------
1859 FUNCTION Set_Attributes (
1860 p_copv_rec IN copv_rec_type,
1861 x_copv_rec OUT NOCOPY copv_rec_type
1862 ) RETURN VARCHAR2 IS
1863 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1864 BEGIN
1865 x_copv_rec := p_copv_rec;
1866 x_copv_rec.OBJECT_VERSION_NUMBER := NVL(x_copv_rec.OBJECT_VERSION_NUMBER, 0) + 1;
1867 RETURN(l_return_status);
1868 END Set_Attributes;
1869 BEGIN
1870 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1871 G_PKG_NAME,
1872 p_init_msg_list,
1873 l_api_version,
1874 p_api_version,
1875 '_PVT',
1876 x_return_status);
1877 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1878 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1879 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1880 RAISE OKC_API.G_EXCEPTION_ERROR;
1881 END IF;
1882 --- Setting item attributes
1883 l_return_status := Set_Attributes(
1884 p_copv_rec, -- IN
1885 l_copv_rec); -- OUT
1886 --- If any errors happen abort API
1887 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1888 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1889 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1890 RAISE OKC_API.G_EXCEPTION_ERROR;
1891 END IF;
1892 l_return_status := populate_new_record(l_copv_rec, l_def_copv_rec);
1893 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1894 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1895 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1896 RAISE OKC_API.G_EXCEPTION_ERROR;
1897 END IF;
1898 l_def_copv_rec := fill_who_columns(l_def_copv_rec);
1899 --- Validate all non-missing attributes (Item Level Validation)
1900 l_return_status := Validate_Attributes(l_def_copv_rec);
1901 --- If any errors happen abort API
1902 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1903 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1904 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1905 RAISE OKC_API.G_EXCEPTION_ERROR;
1906 END IF;
1907
1908 ----- Commented out because Validate_record checks that the cls_code and opn_code being entered
1909 ----- is unique however a record must exist for it to be updated
1910 /*l_return_status := Validate_Record(l_def_copv_rec);
1911 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1912 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1913 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1914 RAISE OKC_API.G_EXCEPTION_ERROR;
1915 END IF;
1916 */
1917 --------------------------------------
1918 -- Move VIEW record to "Child" records
1919 --------------------------------------
1920 migrate(l_def_copv_rec, l_cop_rec);
1921 --------------------------------------------
1922 -- Call the UPDATE_ROW for each child record
1923 --------------------------------------------
1924 update_row(
1925 p_init_msg_list,
1926 x_return_status,
1927 x_msg_count,
1928 x_msg_data,
1929 l_cop_rec,
1930 lx_cop_rec
1931 );
1932 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1933 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1934 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1935 RAISE OKC_API.G_EXCEPTION_ERROR;
1936 END IF;
1937 migrate(lx_cop_rec, l_def_copv_rec);
1938 x_copv_rec := l_def_copv_rec;
1939 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1940 EXCEPTION
1941 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1942 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1943 (
1944 l_api_name,
1945 G_PKG_NAME,
1946 'OKC_API.G_RET_STS_ERROR',
1947 x_msg_count,
1948 x_msg_data,
1949 '_PVT'
1950 );
1951 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1952 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1953 (
1954 l_api_name,
1955 G_PKG_NAME,
1956 'OKC_API.G_RET_STS_UNEXP_ERROR',
1957 x_msg_count,
1958 x_msg_data,
1959 '_PVT'
1960 );
1961 WHEN OTHERS THEN
1962 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1963 (
1964 l_api_name,
1965 G_PKG_NAME,
1966 'OTHERS',
1967 x_msg_count,
1968 x_msg_data,
1969 '_PVT'
1970 );
1971 END update_row;
1972 ---------------------------------------
1976 p_api_version IN NUMBER,
1973 -- PL/SQL TBL update_row for:copv_tbl --
1974 ---------------------------------------
1975 PROCEDURE update_row(
1977 p_init_msg_list IN VARCHAR2 ,
1978 x_return_status OUT NOCOPY VARCHAR2,
1979 x_msg_count OUT NOCOPY NUMBER,
1980 x_msg_data OUT NOCOPY VARCHAR2,
1981 p_copv_tbl IN copv_tbl_type,
1982 x_copv_tbl OUT NOCOPY copv_tbl_type) IS
1983
1984 l_api_version CONSTANT NUMBER := 1;
1985 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
1986 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1987 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1988 i NUMBER := 0;
1989 BEGIN
1990 OKC_API.init_msg_list(p_init_msg_list);
1991 -- Make sure PL/SQL table has records in it before passing
1992 IF (p_copv_tbl.COUNT > 0) THEN
1993 i := p_copv_tbl.FIRST;
1994 LOOP
1995 update_row (
1996 p_api_version => p_api_version,
1997 p_init_msg_list => OKC_API.G_FALSE,
1998 x_return_status => x_return_status,
1999 x_msg_count => x_msg_count,
2000 x_msg_data => x_msg_data,
2001 p_copv_rec => p_copv_tbl(i),
2002 x_copv_rec => x_copv_tbl(i));
2003
2004 -- store the highest degree of error
2005 If x_return_status <> OKC_API.G_RET_STS_SUCCESS Then
2006 If l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
2007 l_overall_status := x_return_status;
2008 End If;
2009 End If;
2010
2011 EXIT WHEN (i = p_copv_tbl.LAST);
2012 i := p_copv_tbl.NEXT(i);
2013 END LOOP;
2014 -- return overall status
2015 x_return_status := l_overall_status;
2016 END IF;
2017 EXCEPTION
2018 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2019 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2020 (
2021 l_api_name,
2022 G_PKG_NAME,
2023 'OKC_API.G_RET_STS_ERROR',
2024 x_msg_count,
2025 x_msg_data,
2026 '_PVT'
2027 );
2028 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2029 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2030 (
2031 l_api_name,
2032 G_PKG_NAME,
2033 'OKC_API.G_RET_STS_UNEXP_ERROR',
2034 x_msg_count,
2035 x_msg_data,
2036 '_PVT'
2037 );
2038 WHEN OTHERS THEN
2039 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2040 (
2041 l_api_name,
2042 G_PKG_NAME,
2043 'OTHERS',
2044 x_msg_count,
2045 x_msg_data,
2046 '_PVT'
2047 );
2048 END update_row;
2049
2050 ---------------------------------------------------------------------------
2051 -- PROCEDURE delete_row
2052 ---------------------------------------------------------------------------
2053 -----------------------------------------
2054 -- delete_row for:OKC_CLASS_OPERATIONS --
2055 -----------------------------------------
2056 PROCEDURE delete_row(
2057 p_init_msg_list IN VARCHAR2 ,
2058 x_return_status OUT NOCOPY VARCHAR2,
2059 x_msg_count OUT NOCOPY NUMBER,
2060 x_msg_data OUT NOCOPY VARCHAR2,
2061 p_cop_rec IN cop_rec_type) IS
2062
2063 l_api_version CONSTANT NUMBER := 1;
2064 l_api_name CONSTANT VARCHAR2(30) := 'OPERATIONS_delete_row';
2065 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2066 l_cop_rec cop_rec_type:= p_cop_rec;
2067 l_row_notfound BOOLEAN := TRUE;
2068 BEGIN
2069 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2070 p_init_msg_list,
2071 '_PVT',
2072 x_return_status);
2073 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2074 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2075 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2076 RAISE OKC_API.G_EXCEPTION_ERROR;
2077 END IF;
2078 DELETE FROM OKC_CLASS_OPERATIONS
2079 WHERE ID = l_cop_rec.id;
2080
2081 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2082 EXCEPTION
2083 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2084 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2085 (
2086 l_api_name,
2087 G_PKG_NAME,
2088 'OKC_API.G_RET_STS_ERROR',
2089 x_msg_count,
2090 x_msg_data,
2091 '_PVT'
2092 );
2093 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2094 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2095 (
2096 l_api_name,
2097 G_PKG_NAME,
2098 'OKC_API.G_RET_STS_UNEXP_ERROR',
2099 x_msg_count,
2100 x_msg_data,
2101 '_PVT'
2102 );
2103 WHEN OTHERS THEN
2104 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2105 (
2106 l_api_name,
2107 G_PKG_NAME,
2108 'OTHERS',
2109 x_msg_count,
2110 x_msg_data,
2111 '_PVT'
2112 );
2113 END delete_row;
2114 -------------------------------------------
2115 -- delete_row for:OKC_CLASS_OPERATIONS_V --
2116 -------------------------------------------
2117 PROCEDURE delete_row(
2118 p_api_version IN NUMBER,
2122 x_msg_data OUT NOCOPY VARCHAR2,
2119 p_init_msg_list IN VARCHAR2 ,
2120 x_return_status OUT NOCOPY VARCHAR2,
2121 x_msg_count OUT NOCOPY NUMBER,
2123 p_copv_rec IN copv_rec_type) IS
2124
2125 l_api_version CONSTANT NUMBER := 1;
2126 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
2127 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2128 l_copv_rec copv_rec_type := p_copv_rec;
2129 l_cop_rec cop_rec_type;
2130 BEGIN
2131 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2132 G_PKG_NAME,
2133 p_init_msg_list,
2134 l_api_version,
2135 p_api_version,
2136 '_PVT',
2137 x_return_status);
2138 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2139 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2140 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2141 RAISE OKC_API.G_EXCEPTION_ERROR;
2142 END IF;
2143 --------------------------------------
2144 -- Move VIEW record to "Child" records
2145 --------------------------------------
2146 migrate(l_copv_rec, l_cop_rec);
2147 --------------------------------------------
2148 -- Call the DELETE_ROW for each child record
2149 --------------------------------------------
2150 delete_row(
2151 p_init_msg_list,
2152 x_return_status,
2153 x_msg_count,
2154 x_msg_data,
2155 l_cop_rec
2156 );
2157 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2158 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2159 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2160 RAISE OKC_API.G_EXCEPTION_ERROR;
2161 END IF;
2162 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2163 EXCEPTION
2164 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2165 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2166 (
2167 l_api_name,
2168 G_PKG_NAME,
2169 'OKC_API.G_RET_STS_ERROR',
2170 x_msg_count,
2171 x_msg_data,
2172 '_PVT'
2173 );
2174 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2175 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2176 (
2177 l_api_name,
2178 G_PKG_NAME,
2179 'OKC_API.G_RET_STS_UNEXP_ERROR',
2180 x_msg_count,
2181 x_msg_data,
2182 '_PVT'
2183 );
2184 WHEN OTHERS THEN
2185 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2186 (
2187 l_api_name,
2188 G_PKG_NAME,
2189 'OTHERS',
2190 x_msg_count,
2191 x_msg_data,
2192 '_PVT'
2193 );
2194 END delete_row;
2195 ---------------------------------------
2196 -- PL/SQL TBL delete_row for:copv_tbl --
2197 ---------------------------------------
2198 PROCEDURE delete_row(
2199 p_api_version IN NUMBER,
2200 p_init_msg_list IN VARCHAR2 ,
2201 x_return_status OUT NOCOPY VARCHAR2,
2202 x_msg_count OUT NOCOPY NUMBER,
2203 x_msg_data OUT NOCOPY VARCHAR2,
2204 p_copv_tbl IN copv_tbl_type) IS
2205
2206 l_api_version CONSTANT NUMBER := 1;
2207 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
2208 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2209 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2210 i NUMBER := 0;
2211 BEGIN
2212 OKC_API.init_msg_list(p_init_msg_list);
2213 -- Make sure PL/SQL table has records in it before passing
2214 IF (p_copv_tbl.COUNT > 0) THEN
2215 i := p_copv_tbl.FIRST;
2216 LOOP
2217 delete_row (
2218 p_api_version => p_api_version,
2219 p_init_msg_list => OKC_API.G_FALSE,
2220 x_return_status => x_return_status,
2221 x_msg_count => x_msg_count,
2222 x_msg_data => x_msg_data,
2223 p_copv_rec => p_copv_tbl(i));
2224
2225 -- store the highest degree of error
2226 If x_return_status <> OKC_API.G_RET_STS_SUCCESS Then
2227 If l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR Then
2228 l_overall_status := x_return_status;
2229 End If;
2230 End If;
2231
2232 EXIT WHEN (i = p_copv_tbl.LAST);
2233 i := p_copv_tbl.NEXT(i);
2234 END LOOP;
2235 -- return overall status
2236 x_return_status := l_overall_status;
2237 END IF;
2238 EXCEPTION
2239 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2240 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2241 (
2242 l_api_name,
2243 G_PKG_NAME,
2244 'OKC_API.G_RET_STS_ERROR',
2245 x_msg_count,
2246 x_msg_data,
2247 '_PVT'
2248 );
2249 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2250 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2251 (
2252 l_api_name,
2253 G_PKG_NAME,
2254 'OKC_API.G_RET_STS_UNEXP_ERROR',
2255 x_msg_count,
2256 x_msg_data,
2257 '_PVT'
2258 );
2259 WHEN OTHERS THEN
2260 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2261 (
2262 l_api_name,
2263 G_PKG_NAME,
2264 'OTHERS',
2265 x_msg_count,
2266 x_msg_data,
2267 '_PVT'
2268 );
2269 END delete_row;
2270 END OKC_COP_PVT;