5: ---------------------------------------------------------------------------
6: -- PROCEDURE load_error_tbl
7: ---------------------------------------------------------------------------
8: PROCEDURE load_error_tbl (
9: px_error_rec IN OUT NOCOPY OKC_API.ERROR_REC_TYPE,
10: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
11:
12: j INTEGER := NVL(px_error_tbl.LAST, 0) + 1;
13: last_msg_idx INTEGER := FND_MSG_PUB.COUNT_MSG;
6: -- PROCEDURE load_error_tbl
7: ---------------------------------------------------------------------------
8: PROCEDURE load_error_tbl (
9: px_error_rec IN OUT NOCOPY OKC_API.ERROR_REC_TYPE,
10: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
11:
12: j INTEGER := NVL(px_error_tbl.LAST, 0) + 1;
13: last_msg_idx INTEGER := FND_MSG_PUB.COUNT_MSG;
14: l_msg_idx INTEGER := FND_MSG_PUB.G_NEXT;
38: ---------------------------------------------------------------------------
39: -- FUNCTION find_highest_exception
40: ---------------------------------------------------------------------------
41: -- Finds the highest exception (G_RET_STS_UNEXP_ERROR)
42: -- in a OKC_API.ERROR_TBL_TYPE, and returns it.
43: FUNCTION find_highest_exception(
44: p_error_tbl IN OKC_API.ERROR_TBL_TYPE
45: ) RETURN VARCHAR2 IS
46: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
40: ---------------------------------------------------------------------------
41: -- Finds the highest exception (G_RET_STS_UNEXP_ERROR)
42: -- in a OKC_API.ERROR_TBL_TYPE, and returns it.
43: FUNCTION find_highest_exception(
44: p_error_tbl IN OKC_API.ERROR_TBL_TYPE
45: ) RETURN VARCHAR2 IS
46: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
47: i INTEGER := 1;
48: BEGIN
42: -- in a OKC_API.ERROR_TBL_TYPE, and returns it.
43: FUNCTION find_highest_exception(
44: p_error_tbl IN OKC_API.ERROR_TBL_TYPE
45: ) RETURN VARCHAR2 IS
46: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
47: i INTEGER := 1;
48: BEGIN
49: IF (p_error_tbl.COUNT > 0) THEN
50: i := p_error_tbl.FIRST;
48: BEGIN
49: IF (p_error_tbl.COUNT > 0) THEN
50: i := p_error_tbl.FIRST;
51: LOOP
52: IF (p_error_tbl(i).error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
53: IF (l_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
54: l_return_status := p_error_tbl(i).error_type;
55: END IF;
56: END IF;
49: IF (p_error_tbl.COUNT > 0) THEN
50: i := p_error_tbl.FIRST;
51: LOOP
52: IF (p_error_tbl(i).error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
53: IF (l_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
54: l_return_status := p_error_tbl(i).error_type;
55: END IF;
56: END IF;
57: EXIT WHEN (i = p_error_tbl.LAST);
231: ) RETURN hstv_rec_type IS
232: l_hstv_rec hstv_rec_type;
233: l_row_notfound BOOLEAN := TRUE;
234: BEGIN
235: x_return_status := OKC_API.G_RET_STS_SUCCESS;
236: l_hstv_rec := get_rec(p_hstv_rec, l_row_notfound);
237: IF (l_row_notfound) THEN
238: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
239: x_return_status := OKC_API.G_RET_STS_ERROR;
234: BEGIN
235: x_return_status := OKC_API.G_RET_STS_SUCCESS;
236: l_hstv_rec := get_rec(p_hstv_rec, l_row_notfound);
237: IF (l_row_notfound) THEN
238: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
239: x_return_status := OKC_API.G_RET_STS_ERROR;
240: END IF;
241: RETURN(l_hstv_rec);
242: END get_rec;
235: x_return_status := OKC_API.G_RET_STS_SUCCESS;
236: l_hstv_rec := get_rec(p_hstv_rec, l_row_notfound);
237: IF (l_row_notfound) THEN
238: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
239: x_return_status := OKC_API.G_RET_STS_ERROR;
240: END IF;
241: RETURN(l_hstv_rec);
242: END get_rec;
243: -----------------------------------------------------------
322: ) RETURN hst_rec_type IS
323: l_hst_rec hst_rec_type;
324: l_row_notfound BOOLEAN := TRUE;
325: BEGIN
326: x_return_status := OKC_API.G_RET_STS_SUCCESS;
327: l_hst_rec := get_rec(p_hst_rec, l_row_notfound);
328: IF (l_row_notfound) THEN
329: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
330: x_return_status := OKC_API.G_RET_STS_ERROR;
325: BEGIN
326: x_return_status := OKC_API.G_RET_STS_SUCCESS;
327: l_hst_rec := get_rec(p_hst_rec, l_row_notfound);
328: IF (l_row_notfound) THEN
329: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
330: x_return_status := OKC_API.G_RET_STS_ERROR;
331: END IF;
332: RETURN(l_hst_rec);
333: END get_rec;
326: x_return_status := OKC_API.G_RET_STS_SUCCESS;
327: l_hst_rec := get_rec(p_hst_rec, l_row_notfound);
328: IF (l_row_notfound) THEN
329: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
330: x_return_status := OKC_API.G_RET_STS_ERROR;
331: END IF;
332: RETURN(l_hst_rec);
333: END get_rec;
334: -----------------------------------------------------------
394: ) RETURN okc_k_history_tl_rec_type IS
395: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
396: l_row_notfound BOOLEAN := TRUE;
397: BEGIN
398: x_return_status := OKC_API.G_RET_STS_SUCCESS;
399: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_row_notfound);
400: IF (l_row_notfound) THEN
401: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
402: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LANGUAGE');
397: BEGIN
398: x_return_status := OKC_API.G_RET_STS_SUCCESS;
399: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_row_notfound);
400: IF (l_row_notfound) THEN
401: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
402: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LANGUAGE');
403: x_return_status := OKC_API.G_RET_STS_ERROR;
404: END IF;
405: RETURN(l_okc_k_history_tl_rec);
398: x_return_status := OKC_API.G_RET_STS_SUCCESS;
399: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_row_notfound);
400: IF (l_row_notfound) THEN
401: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
402: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LANGUAGE');
403: x_return_status := OKC_API.G_RET_STS_ERROR;
404: END IF;
405: RETURN(l_okc_k_history_tl_rec);
406: END get_rec;
399: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_row_notfound);
400: IF (l_row_notfound) THEN
401: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
402: OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LANGUAGE');
403: x_return_status := OKC_API.G_RET_STS_ERROR;
404: END IF;
405: RETURN(l_okc_k_history_tl_rec);
406: END get_rec;
407: -----------------------------------------------------------
421: p_hstv_rec IN hstv_rec_type
422: ) RETURN hstv_rec_type IS
423: l_hstv_rec hstv_rec_type := p_hstv_rec;
424: BEGIN
425: IF (l_hstv_rec.id = OKC_API.G_MISS_NUM ) THEN
426: l_hstv_rec.id := NULL;
427: END IF;
428: IF (l_hstv_rec.chr_id = OKC_API.G_MISS_NUM ) THEN
429: l_hstv_rec.chr_id := NULL;
424: BEGIN
425: IF (l_hstv_rec.id = OKC_API.G_MISS_NUM ) THEN
426: l_hstv_rec.id := NULL;
427: END IF;
428: IF (l_hstv_rec.chr_id = OKC_API.G_MISS_NUM ) THEN
429: l_hstv_rec.chr_id := NULL;
430: END IF;
431: IF (l_hstv_rec.cle_id = OKC_API.G_MISS_NUM ) THEN
432: l_hstv_rec.cle_id := NULL;
427: END IF;
428: IF (l_hstv_rec.chr_id = OKC_API.G_MISS_NUM ) THEN
429: l_hstv_rec.chr_id := NULL;
430: END IF;
431: IF (l_hstv_rec.cle_id = OKC_API.G_MISS_NUM ) THEN
432: l_hstv_rec.cle_id := NULL;
433: END IF;
434: IF (l_hstv_rec.contract_version = OKC_API.G_MISS_CHAR ) THEN
435: l_hstv_rec.contract_version := NULL;
430: END IF;
431: IF (l_hstv_rec.cle_id = OKC_API.G_MISS_NUM ) THEN
432: l_hstv_rec.cle_id := NULL;
433: END IF;
434: IF (l_hstv_rec.contract_version = OKC_API.G_MISS_CHAR ) THEN
435: l_hstv_rec.contract_version := NULL;
436: END IF;
437: IF (l_hstv_rec.object_version_number = OKC_API.G_MISS_NUM ) THEN
438: l_hstv_rec.object_version_number := NULL;
433: END IF;
434: IF (l_hstv_rec.contract_version = OKC_API.G_MISS_CHAR ) THEN
435: l_hstv_rec.contract_version := NULL;
436: END IF;
437: IF (l_hstv_rec.object_version_number = OKC_API.G_MISS_NUM ) THEN
438: l_hstv_rec.object_version_number := NULL;
439: END IF;
440: IF (l_hstv_rec.opn_code = OKC_API.G_MISS_CHAR ) THEN
441: l_hstv_rec.opn_code := NULL;
436: END IF;
437: IF (l_hstv_rec.object_version_number = OKC_API.G_MISS_NUM ) THEN
438: l_hstv_rec.object_version_number := NULL;
439: END IF;
440: IF (l_hstv_rec.opn_code = OKC_API.G_MISS_CHAR ) THEN
441: l_hstv_rec.opn_code := NULL;
442: END IF;
443: IF (l_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR ) THEN
444: l_hstv_rec.sts_code_from := NULL;
439: END IF;
440: IF (l_hstv_rec.opn_code = OKC_API.G_MISS_CHAR ) THEN
441: l_hstv_rec.opn_code := NULL;
442: END IF;
443: IF (l_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR ) THEN
444: l_hstv_rec.sts_code_from := NULL;
445: END IF;
446: IF (l_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR ) THEN
447: l_hstv_rec.sts_code_to := NULL;
442: END IF;
443: IF (l_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR ) THEN
444: l_hstv_rec.sts_code_from := NULL;
445: END IF;
446: IF (l_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR ) THEN
447: l_hstv_rec.sts_code_to := NULL;
448: END IF;
449: IF (l_hstv_rec.reason_code = OKC_API.G_MISS_CHAR ) THEN
450: l_hstv_rec.reason_code := NULL;
445: END IF;
446: IF (l_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR ) THEN
447: l_hstv_rec.sts_code_to := NULL;
448: END IF;
449: IF (l_hstv_rec.reason_code = OKC_API.G_MISS_CHAR ) THEN
450: l_hstv_rec.reason_code := NULL;
451: END IF;
452: IF (l_hstv_rec.trn_code = OKC_API.G_MISS_CHAR ) THEN
453: l_hstv_rec.trn_code := NULL;
448: END IF;
449: IF (l_hstv_rec.reason_code = OKC_API.G_MISS_CHAR ) THEN
450: l_hstv_rec.reason_code := NULL;
451: END IF;
452: IF (l_hstv_rec.trn_code = OKC_API.G_MISS_CHAR ) THEN
453: l_hstv_rec.trn_code := NULL;
454: END IF;
455: IF (l_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR ) THEN
456: l_hstv_rec.manual_yn := NULL;
451: END IF;
452: IF (l_hstv_rec.trn_code = OKC_API.G_MISS_CHAR ) THEN
453: l_hstv_rec.trn_code := NULL;
454: END IF;
455: IF (l_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR ) THEN
456: l_hstv_rec.manual_yn := NULL;
457: END IF;
458: IF (l_hstv_rec.comments = OKC_API.G_MISS_CHAR ) THEN
459: l_hstv_rec.comments := NULL;
454: END IF;
455: IF (l_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR ) THEN
456: l_hstv_rec.manual_yn := NULL;
457: END IF;
458: IF (l_hstv_rec.comments = OKC_API.G_MISS_CHAR ) THEN
459: l_hstv_rec.comments := NULL;
460: END IF;
461: IF (l_hstv_rec.created_by = OKC_API.G_MISS_NUM ) THEN
462: l_hstv_rec.created_by := NULL;
457: END IF;
458: IF (l_hstv_rec.comments = OKC_API.G_MISS_CHAR ) THEN
459: l_hstv_rec.comments := NULL;
460: END IF;
461: IF (l_hstv_rec.created_by = OKC_API.G_MISS_NUM ) THEN
462: l_hstv_rec.created_by := NULL;
463: END IF;
464: IF (l_hstv_rec.creation_date = OKC_API.G_MISS_DATE ) THEN
465: l_hstv_rec.creation_date := NULL;
460: END IF;
461: IF (l_hstv_rec.created_by = OKC_API.G_MISS_NUM ) THEN
462: l_hstv_rec.created_by := NULL;
463: END IF;
464: IF (l_hstv_rec.creation_date = OKC_API.G_MISS_DATE ) THEN
465: l_hstv_rec.creation_date := NULL;
466: END IF;
467: IF (l_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM ) THEN
468: l_hstv_rec.last_updated_by := NULL;
463: END IF;
464: IF (l_hstv_rec.creation_date = OKC_API.G_MISS_DATE ) THEN
465: l_hstv_rec.creation_date := NULL;
466: END IF;
467: IF (l_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM ) THEN
468: l_hstv_rec.last_updated_by := NULL;
469: END IF;
470: IF (l_hstv_rec.last_update_date = OKC_API.G_MISS_DATE ) THEN
471: l_hstv_rec.last_update_date := NULL;
466: END IF;
467: IF (l_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM ) THEN
468: l_hstv_rec.last_updated_by := NULL;
469: END IF;
470: IF (l_hstv_rec.last_update_date = OKC_API.G_MISS_DATE ) THEN
471: l_hstv_rec.last_update_date := NULL;
472: END IF;
473: IF (l_hstv_rec.last_update_login = OKC_API.G_MISS_NUM ) THEN
474: l_hstv_rec.last_update_login := NULL;
469: END IF;
470: IF (l_hstv_rec.last_update_date = OKC_API.G_MISS_DATE ) THEN
471: l_hstv_rec.last_update_date := NULL;
472: END IF;
473: IF (l_hstv_rec.last_update_login = OKC_API.G_MISS_NUM ) THEN
474: l_hstv_rec.last_update_login := NULL;
475: END IF;
476: IF (l_hstv_rec.program_application_id = OKC_API.G_MISS_NUM ) THEN
477: l_hstv_rec.program_application_id := NULL;
472: END IF;
473: IF (l_hstv_rec.last_update_login = OKC_API.G_MISS_NUM ) THEN
474: l_hstv_rec.last_update_login := NULL;
475: END IF;
476: IF (l_hstv_rec.program_application_id = OKC_API.G_MISS_NUM ) THEN
477: l_hstv_rec.program_application_id := NULL;
478: END IF;
479: IF (l_hstv_rec.program_id = OKC_API.G_MISS_NUM ) THEN
480: l_hstv_rec.program_id := NULL;
475: END IF;
476: IF (l_hstv_rec.program_application_id = OKC_API.G_MISS_NUM ) THEN
477: l_hstv_rec.program_application_id := NULL;
478: END IF;
479: IF (l_hstv_rec.program_id = OKC_API.G_MISS_NUM ) THEN
480: l_hstv_rec.program_id := NULL;
481: END IF;
482: IF (l_hstv_rec.program_update_date = OKC_API.G_MISS_DATE ) THEN
483: l_hstv_rec.program_update_date := NULL;
478: END IF;
479: IF (l_hstv_rec.program_id = OKC_API.G_MISS_NUM ) THEN
480: l_hstv_rec.program_id := NULL;
481: END IF;
482: IF (l_hstv_rec.program_update_date = OKC_API.G_MISS_DATE ) THEN
483: l_hstv_rec.program_update_date := NULL;
484: END IF;
485: IF (l_hstv_rec.request_id = OKC_API.G_MISS_NUM ) THEN
486: l_hstv_rec.request_id := NULL;
481: END IF;
482: IF (l_hstv_rec.program_update_date = OKC_API.G_MISS_DATE ) THEN
483: l_hstv_rec.program_update_date := NULL;
484: END IF;
485: IF (l_hstv_rec.request_id = OKC_API.G_MISS_NUM ) THEN
486: l_hstv_rec.request_id := NULL;
487: END IF;
488: RETURN(l_hstv_rec);
489: END null_out_defaults;
494: PROCEDURE validate_chr_id(
495: x_return_status OUT NOCOPY VARCHAR2,
496: p_chr_id IN NUMBER) IS
497: BEGIN
498: x_return_status := OKC_API.G_RET_STS_SUCCESS;
499: IF (p_chr_id = OKC_API.G_MISS_NUM OR
500: p_chr_id IS NULL)
501: THEN
502: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'chr_id');
495: x_return_status OUT NOCOPY VARCHAR2,
496: p_chr_id IN NUMBER) IS
497: BEGIN
498: x_return_status := OKC_API.G_RET_STS_SUCCESS;
499: IF (p_chr_id = OKC_API.G_MISS_NUM OR
500: p_chr_id IS NULL)
501: THEN
502: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'chr_id');
503: x_return_status := OKC_API.G_RET_STS_ERROR;
498: x_return_status := OKC_API.G_RET_STS_SUCCESS;
499: IF (p_chr_id = OKC_API.G_MISS_NUM OR
500: p_chr_id IS NULL)
501: THEN
502: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'chr_id');
503: x_return_status := OKC_API.G_RET_STS_ERROR;
504: RAISE G_EXCEPTION_HALT_VALIDATION;
505: END IF;
506: EXCEPTION
499: IF (p_chr_id = OKC_API.G_MISS_NUM OR
500: p_chr_id IS NULL)
501: THEN
502: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'chr_id');
503: x_return_status := OKC_API.G_RET_STS_ERROR;
504: RAISE G_EXCEPTION_HALT_VALIDATION;
505: END IF;
506: EXCEPTION
507: WHEN G_EXCEPTION_HALT_VALIDATION THEN
506: EXCEPTION
507: WHEN G_EXCEPTION_HALT_VALIDATION THEN
508: null;
509: WHEN OTHERS THEN
510: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
511: ,p_msg_name => G_UNEXPECTED_ERROR
512: ,p_token1 => G_SQLCODE_TOKEN
513: ,p_token1_value => SQLCODE
514: ,p_token2 => G_SQLERRM_TOKEN
512: ,p_token1 => G_SQLCODE_TOKEN
513: ,p_token1_value => SQLCODE
514: ,p_token2 => G_SQLERRM_TOKEN
515: ,p_token2_value => SQLERRM);
516: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
517: END validate_chr_id;
518: -----------------------------------------------
519: -- Validate_Attributes for: CONTRACT_VERSION --
520: -----------------------------------------------
521: PROCEDURE validate_contract_version(
522: x_return_status OUT NOCOPY VARCHAR2,
523: p_contract_version IN VARCHAR2) IS
524: BEGIN
525: x_return_status := OKC_API.G_RET_STS_SUCCESS;
526: IF (p_contract_version = OKC_API.G_MISS_CHAR OR
527: p_contract_version IS NULL)
528: THEN
529: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'contract_version');
522: x_return_status OUT NOCOPY VARCHAR2,
523: p_contract_version IN VARCHAR2) IS
524: BEGIN
525: x_return_status := OKC_API.G_RET_STS_SUCCESS;
526: IF (p_contract_version = OKC_API.G_MISS_CHAR OR
527: p_contract_version IS NULL)
528: THEN
529: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'contract_version');
530: x_return_status := OKC_API.G_RET_STS_ERROR;
525: x_return_status := OKC_API.G_RET_STS_SUCCESS;
526: IF (p_contract_version = OKC_API.G_MISS_CHAR OR
527: p_contract_version IS NULL)
528: THEN
529: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'contract_version');
530: x_return_status := OKC_API.G_RET_STS_ERROR;
531: RAISE G_EXCEPTION_HALT_VALIDATION;
532: END IF;
533: EXCEPTION
526: IF (p_contract_version = OKC_API.G_MISS_CHAR OR
527: p_contract_version IS NULL)
528: THEN
529: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'contract_version');
530: x_return_status := OKC_API.G_RET_STS_ERROR;
531: RAISE G_EXCEPTION_HALT_VALIDATION;
532: END IF;
533: EXCEPTION
534: WHEN G_EXCEPTION_HALT_VALIDATION THEN
533: EXCEPTION
534: WHEN G_EXCEPTION_HALT_VALIDATION THEN
535: null;
536: WHEN OTHERS THEN
537: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
538: ,p_msg_name => G_UNEXPECTED_ERROR
539: ,p_token1 => G_SQLCODE_TOKEN
540: ,p_token1_value => SQLCODE
541: ,p_token2 => G_SQLERRM_TOKEN
539: ,p_token1 => G_SQLCODE_TOKEN
540: ,p_token1_value => SQLCODE
541: ,p_token2 => G_SQLERRM_TOKEN
542: ,p_token2_value => SQLERRM);
543: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
544: END validate_contract_version;
545: ----------------------------------------------------
546: -- Validate_Attributes for: OBJECT_VERSION_NUMBER --
547: ----------------------------------------------------
548: PROCEDURE validate_object_version_number(
549: x_return_status OUT NOCOPY VARCHAR2,
550: p_object_version_number IN NUMBER) IS
551: BEGIN
552: x_return_status := OKC_API.G_RET_STS_SUCCESS;
553: IF (p_object_version_number = OKC_API.G_MISS_NUM OR
554: p_object_version_number IS NULL)
555: THEN
556: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
549: x_return_status OUT NOCOPY VARCHAR2,
550: p_object_version_number IN NUMBER) IS
551: BEGIN
552: x_return_status := OKC_API.G_RET_STS_SUCCESS;
553: IF (p_object_version_number = OKC_API.G_MISS_NUM OR
554: p_object_version_number IS NULL)
555: THEN
556: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
557: x_return_status := OKC_API.G_RET_STS_ERROR;
552: x_return_status := OKC_API.G_RET_STS_SUCCESS;
553: IF (p_object_version_number = OKC_API.G_MISS_NUM OR
554: p_object_version_number IS NULL)
555: THEN
556: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
557: x_return_status := OKC_API.G_RET_STS_ERROR;
558: RAISE G_EXCEPTION_HALT_VALIDATION;
559: END IF;
560: EXCEPTION
553: IF (p_object_version_number = OKC_API.G_MISS_NUM OR
554: p_object_version_number IS NULL)
555: THEN
556: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
557: x_return_status := OKC_API.G_RET_STS_ERROR;
558: RAISE G_EXCEPTION_HALT_VALIDATION;
559: END IF;
560: EXCEPTION
561: WHEN G_EXCEPTION_HALT_VALIDATION THEN
560: EXCEPTION
561: WHEN G_EXCEPTION_HALT_VALIDATION THEN
562: null;
563: WHEN OTHERS THEN
564: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
565: ,p_msg_name => G_UNEXPECTED_ERROR
566: ,p_token1 => G_SQLCODE_TOKEN
567: ,p_token1_value => SQLCODE
568: ,p_token2 => G_SQLERRM_TOKEN
566: ,p_token1 => G_SQLCODE_TOKEN
567: ,p_token1_value => SQLCODE
568: ,p_token2 => G_SQLERRM_TOKEN
569: ,p_token2_value => SQLERRM);
570: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
571: END validate_object_version_number;
572: ---------------------------------------
573: -- Validate_Attributes for: OPN_CODE --
574: ---------------------------------------
575: PROCEDURE validate_opn_code(
576: x_return_status OUT NOCOPY VARCHAR2,
577: p_opn_code IN VARCHAR2) IS
578: BEGIN
579: x_return_status := OKC_API.G_RET_STS_SUCCESS;
580: IF (p_opn_code = OKC_API.G_MISS_CHAR OR
581: p_opn_code IS NULL)
582: THEN
583: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'opn_code');
576: x_return_status OUT NOCOPY VARCHAR2,
577: p_opn_code IN VARCHAR2) IS
578: BEGIN
579: x_return_status := OKC_API.G_RET_STS_SUCCESS;
580: IF (p_opn_code = OKC_API.G_MISS_CHAR OR
581: p_opn_code IS NULL)
582: THEN
583: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'opn_code');
584: x_return_status := OKC_API.G_RET_STS_ERROR;
579: x_return_status := OKC_API.G_RET_STS_SUCCESS;
580: IF (p_opn_code = OKC_API.G_MISS_CHAR OR
581: p_opn_code IS NULL)
582: THEN
583: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'opn_code');
584: x_return_status := OKC_API.G_RET_STS_ERROR;
585: RAISE G_EXCEPTION_HALT_VALIDATION;
586: END IF;
587: EXCEPTION
580: IF (p_opn_code = OKC_API.G_MISS_CHAR OR
581: p_opn_code IS NULL)
582: THEN
583: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'opn_code');
584: x_return_status := OKC_API.G_RET_STS_ERROR;
585: RAISE G_EXCEPTION_HALT_VALIDATION;
586: END IF;
587: EXCEPTION
588: WHEN G_EXCEPTION_HALT_VALIDATION THEN
587: EXCEPTION
588: WHEN G_EXCEPTION_HALT_VALIDATION THEN
589: null;
590: WHEN OTHERS THEN
591: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
592: ,p_msg_name => G_UNEXPECTED_ERROR
593: ,p_token1 => G_SQLCODE_TOKEN
594: ,p_token1_value => SQLCODE
595: ,p_token2 => G_SQLERRM_TOKEN
593: ,p_token1 => G_SQLCODE_TOKEN
594: ,p_token1_value => SQLCODE
595: ,p_token2 => G_SQLERRM_TOKEN
596: ,p_token2_value => SQLERRM);
597: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
598: END validate_opn_code;
599: ------------------------------------------
600: -- Validate_Attributes for: REASON_CODE --
601: ------------------------------------------
621:
622: l_lookup_code fnd_lookups.lookup_code%TYPE;
623:
624: BEGIN
625: x_return_status := OKC_API.G_RET_STS_SUCCESS;
626:
627: -- enforce foreign key if data exists
628: If (p_reason_code <> OKC_API.G_MISS_CHAR and
629: p_reason_code IS NOT NULL)
624: BEGIN
625: x_return_status := OKC_API.G_RET_STS_SUCCESS;
626:
627: -- enforce foreign key if data exists
628: If (p_reason_code <> OKC_API.G_MISS_CHAR and
629: p_reason_code IS NOT NULL)
630: Then
631: -- Check if the value is a valid code from lookup table
632: /*
636: -- bug 4622645
637: OPEN csr_reason_code;
638: FETCH csr_reason_code INTO l_lookup_code;
639: IF csr_reason_code%NOTFOUND THEN
640: x_return_status := OKC_API.G_RET_STS_ERROR;
641: END IF; -- not a valid code
642: CLOSE csr_reason_code;
643:
644:
641: END IF; -- not a valid code
642: CLOSE csr_reason_code;
643:
644:
645: If (x_return_status = OKC_API.G_RET_STS_ERROR) Then
646: --set error message in message stack
647: OKC_API.SET_MESSAGE(
648: p_app_name => G_APP_NAME,
649: p_msg_name => G_INVALID_VALUE,
643:
644:
645: If (x_return_status = OKC_API.G_RET_STS_ERROR) Then
646: --set error message in message stack
647: OKC_API.SET_MESSAGE(
648: p_app_name => G_APP_NAME,
649: p_msg_name => G_INVALID_VALUE,
650: p_token1 => G_COL_NAME_TOKEN,
651: p_token1_value => 'REASON_CODE');
649: p_msg_name => G_INVALID_VALUE,
650: p_token1 => G_COL_NAME_TOKEN,
651: p_token1_value => 'REASON_CODE');
652: raise G_EXCEPTION_HALT_VALIDATION;
653: Elsif (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) Then
654: raise G_EXCEPTION_HALT_VALIDATION;
655: End If;
656: End If;
657:
658: EXCEPTION
659: WHEN G_EXCEPTION_HALT_VALIDATION THEN
660: null;
661: WHEN OTHERS THEN
662: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
663: ,p_msg_name => G_UNEXPECTED_ERROR
664: ,p_token1 => G_SQLCODE_TOKEN
665: ,p_token1_value => SQLCODE
666: ,p_token2 => G_SQLERRM_TOKEN
664: ,p_token1 => G_SQLCODE_TOKEN
665: ,p_token1_value => SQLCODE
666: ,p_token2 => G_SQLERRM_TOKEN
667: ,p_token2_value => SQLERRM);
668: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
669: END validate_reason_code;
670: ----------------------------------------
671: -- Validate_Attributes for: MANUAL_YN --
672: ----------------------------------------
673: PROCEDURE validate_manual_yn(
674: x_return_status OUT NOCOPY VARCHAR2,
675: p_manual_yn IN VARCHAR2) IS
676: BEGIN
677: x_return_status := OKC_API.G_RET_STS_SUCCESS;
678: IF (p_manual_yn = OKC_API.G_MISS_CHAR OR
679: p_manual_yn IS NULL)
680: THEN
681: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'manual_yn');
674: x_return_status OUT NOCOPY VARCHAR2,
675: p_manual_yn IN VARCHAR2) IS
676: BEGIN
677: x_return_status := OKC_API.G_RET_STS_SUCCESS;
678: IF (p_manual_yn = OKC_API.G_MISS_CHAR OR
679: p_manual_yn IS NULL)
680: THEN
681: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'manual_yn');
682: x_return_status := OKC_API.G_RET_STS_ERROR;
677: x_return_status := OKC_API.G_RET_STS_SUCCESS;
678: IF (p_manual_yn = OKC_API.G_MISS_CHAR OR
679: p_manual_yn IS NULL)
680: THEN
681: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'manual_yn');
682: x_return_status := OKC_API.G_RET_STS_ERROR;
683: RAISE G_EXCEPTION_HALT_VALIDATION;
684: END IF;
685:
678: IF (p_manual_yn = OKC_API.G_MISS_CHAR OR
679: p_manual_yn IS NULL)
680: THEN
681: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'manual_yn');
682: x_return_status := OKC_API.G_RET_STS_ERROR;
683: RAISE G_EXCEPTION_HALT_VALIDATION;
684: END IF;
685:
686: -- check allowed values
684: END IF;
685:
686: -- check allowed values
687: If (upper(p_manual_yn) NOT IN ('Y','N')) Then
688: OKC_API.SET_MESSAGE(p_app_name => g_app_name,
689: p_msg_name => g_invalid_value,
690: p_token1 => g_col_name_token,
691: p_token1_value => 'manual_yn');
692: -- notify caller of an error
689: p_msg_name => g_invalid_value,
690: p_token1 => g_col_name_token,
691: p_token1_value => 'manual_yn');
692: -- notify caller of an error
693: x_return_status := OKC_API.G_RET_STS_ERROR;
694: End If;
695:
696: EXCEPTION
697: WHEN G_EXCEPTION_HALT_VALIDATION THEN
696: EXCEPTION
697: WHEN G_EXCEPTION_HALT_VALIDATION THEN
698: null;
699: WHEN OTHERS THEN
700: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
701: ,p_msg_name => G_UNEXPECTED_ERROR
702: ,p_token1 => G_SQLCODE_TOKEN
703: ,p_token1_value => SQLCODE
704: ,p_token2 => G_SQLERRM_TOKEN
702: ,p_token1 => G_SQLCODE_TOKEN
703: ,p_token1_value => SQLCODE
704: ,p_token2 => G_SQLERRM_TOKEN
705: ,p_token2_value => SQLERRM);
706: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
707: END validate_manual_yn;
708:
709: ---------------------------------------
710: -- Validate_Attributes for: TRN_CODE --
712: PROCEDURE validate_trn_code(
713: x_return_status OUT NOCOPY VARCHAR2,
714: p_trn_code IN VARCHAR2) IS
715: BEGIN
716: x_return_status := OKC_API.G_RET_STS_SUCCESS;
717:
718: -- enforce foreign key if data exists
719: If (p_trn_code <> OKC_API.G_MISS_CHAR and
720: p_trn_code IS NOT NULL)
715: BEGIN
716: x_return_status := OKC_API.G_RET_STS_SUCCESS;
717:
718: -- enforce foreign key if data exists
719: If (p_trn_code <> OKC_API.G_MISS_CHAR and
720: p_trn_code IS NOT NULL)
721: Then
722: -- Check if the value is a valid code from lookup table
723: x_return_status := OKC_UTIL.check_lookup_code('OKC_TERMINATION_REASON',
721: Then
722: -- Check if the value is a valid code from lookup table
723: x_return_status := OKC_UTIL.check_lookup_code('OKC_TERMINATION_REASON',
724: p_trn_code);
725: If (x_return_status = OKC_API.G_RET_STS_ERROR) Then
726: --set error message in message stack
727: OKC_API.SET_MESSAGE(
728: p_app_name => G_APP_NAME,
729: p_msg_name => G_INVALID_VALUE,
723: x_return_status := OKC_UTIL.check_lookup_code('OKC_TERMINATION_REASON',
724: p_trn_code);
725: If (x_return_status = OKC_API.G_RET_STS_ERROR) Then
726: --set error message in message stack
727: OKC_API.SET_MESSAGE(
728: p_app_name => G_APP_NAME,
729: p_msg_name => G_INVALID_VALUE,
730: p_token1 => G_COL_NAME_TOKEN,
731: p_token1_value => 'TERMINATION_REASON');
729: p_msg_name => G_INVALID_VALUE,
730: p_token1 => G_COL_NAME_TOKEN,
731: p_token1_value => 'TERMINATION_REASON');
732: raise G_EXCEPTION_HALT_VALIDATION;
733: Elsif (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) Then
734: raise G_EXCEPTION_HALT_VALIDATION;
735: End If;
736: End If;
737:
738: EXCEPTION
739: WHEN G_EXCEPTION_HALT_VALIDATION THEN
740: null;
741: WHEN OTHERS THEN
742: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
743: ,p_msg_name => G_UNEXPECTED_ERROR
744: ,p_token1 => G_SQLCODE_TOKEN
745: ,p_token1_value => SQLCODE
746: ,p_token2 => G_SQLERRM_TOKEN
744: ,p_token1 => G_SQLCODE_TOKEN
745: ,p_token1_value => SQLCODE
746: ,p_token2 => G_SQLERRM_TOKEN
747: ,p_token2_value => SQLERRM);
748: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
749: END validate_trn_code;
750:
751: ---------------------------------------------------------------------------
752: -- FUNCTION Validate_Attributes
756: ---------------------------------------------
757: FUNCTION Validate_Attributes (
758: p_hstv_rec IN hstv_rec_type
759: ) RETURN VARCHAR2 IS
760: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
761: x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
762: BEGIN
763: -----------------------------
764: -- Column Level Validation --
757: FUNCTION Validate_Attributes (
758: p_hstv_rec IN hstv_rec_type
759: ) RETURN VARCHAR2 IS
760: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
761: x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
762: BEGIN
763: -----------------------------
764: -- Column Level Validation --
765: -----------------------------
767: -- ***
768: -- chr_id
769: -- ***
770: validate_chr_id(x_return_status, p_hstv_rec.chr_id);
771: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
772: l_return_status := x_return_status;
773: RAISE G_EXCEPTION_HALT_VALIDATION;
774: END IF;
775:
776: -- ***
777: -- contract_version
778: -- ***
779: validate_contract_version(x_return_status, p_hstv_rec.contract_version);
780: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
781: l_return_status := x_return_status;
782: RAISE G_EXCEPTION_HALT_VALIDATION;
783: END IF;
784:
785: -- ***
786: -- object_version_number
787: -- ***
788: validate_object_version_number(x_return_status, p_hstv_rec.object_version_number);
789: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
790: l_return_status := x_return_status;
791: RAISE G_EXCEPTION_HALT_VALIDATION;
792: END IF;
793:
794: -- ***
795: -- opn_code
796: -- ***
797: validate_opn_code(x_return_status, p_hstv_rec.opn_code);
798: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
799: l_return_status := x_return_status;
800: RAISE G_EXCEPTION_HALT_VALIDATION;
801: END IF;
802:
803: -- ***
804: -- reason_code
805: -- ***
806: validate_reason_code(x_return_status, p_hstv_rec.reason_code);
807: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
808: l_return_status := x_return_status;
809: RAISE G_EXCEPTION_HALT_VALIDATION;
810: END IF;
811:
812: -- ***
813: -- manual_yn
814: -- ***
815: validate_manual_yn(x_return_status, p_hstv_rec.manual_yn);
816: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
817: l_return_status := x_return_status;
818: RAISE G_EXCEPTION_HALT_VALIDATION;
819: END IF;
820:
822: -- trn_code
823: -- ***
824: /* -- Commented out by vjramali for bug 5139640
825: validate_trn_code(x_return_status, p_hstv_rec.trn_code);
826: IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
827: l_return_status := x_return_status;
828: RAISE G_EXCEPTION_HALT_VALIDATION;
829: END IF;
830: */
833: EXCEPTION
834: WHEN G_EXCEPTION_HALT_VALIDATION THEN
835: RETURN(l_return_status);
836: WHEN OTHERS THEN
837: OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
838: ,p_msg_name => G_UNEXPECTED_ERROR
839: ,p_token1 => G_SQLCODE_TOKEN
840: ,p_token1_value => SQLCODE
841: ,p_token2 => G_SQLERRM_TOKEN
839: ,p_token1 => G_SQLCODE_TOKEN
840: ,p_token1_value => SQLCODE
841: ,p_token2 => G_SQLERRM_TOKEN
842: ,p_token2_value => SQLERRM);
843: l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
844: RETURN(l_return_status);
845: END Validate_Attributes;
846: ---------------------------------------------------------------------------
847: -- PROCEDURE Validate_Record
852: FUNCTION Validate_Record (
853: p_hstv_rec IN hstv_rec_type,
854: p_db_hstv_rec IN hstv_rec_type
855: ) RETURN VARCHAR2 IS
856: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
857: ------------------------------------
858: -- FUNCTION validate_foreign_keys --
859: ------------------------------------
860: FUNCTION validate_foreign_keys (
891: FROM Okc_Operations_B
892: WHERE okc_operations_b.code = p_code;
893: l_okc_opnv_pk okc_opnv_pk_csr%ROWTYPE;
894:
895: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
896: l_row_notfound BOOLEAN := TRUE;
897: BEGIN
898: IF ((p_hstv_rec.CHR_ID IS NOT NULL)
899: AND
903: FETCH okc_chrv_pk_csr INTO l_okc_chrv_pk;
904: l_row_notfound := okc_chrv_pk_csr%NOTFOUND;
905: CLOSE okc_chrv_pk_csr;
906: IF (l_row_notfound) THEN
907: OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'CHR_ID');
908: RAISE item_not_found_error;
909: END IF;
910: END IF;
911: IF ((p_hstv_rec.CLE_ID IS NOT NULL)
916: FETCH okc_clev_pk_csr INTO l_okc_clev_pk;
917: l_row_notfound := okc_clev_pk_csr%NOTFOUND;
918: CLOSE okc_clev_pk_csr;
919: IF (l_row_notfound) THEN
920: OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'CLE_ID');
921: RAISE item_not_found_error;
922: END IF;
923: END IF;
924: IF ((p_hstv_rec.OPN_CODE IS NOT NULL)
929: FETCH okc_opnv_pk_csr INTO l_okc_opnv_pk;
930: l_row_notfound := okc_opnv_pk_csr%NOTFOUND;
931: CLOSE okc_opnv_pk_csr;
932: IF (l_row_notfound) THEN
933: OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'OPN_CODE');
934: RAISE item_not_found_error;
935: END IF;
936: END IF;
937: IF ((p_hstv_rec.STS_CODE_FROM IS NOT NULL)
942: FETCH hstv_stsv_fk1_csr INTO l_hstv_stsv_fk1;
943: l_row_notfound := hstv_stsv_fk1_csr%NOTFOUND;
944: CLOSE hstv_stsv_fk1_csr;
945: IF (l_row_notfound) THEN
946: OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'STS_CODE_FROM');
947: RAISE item_not_found_error;
948: END IF;
949: END IF;
950: IF ((p_hstv_rec.STS_CODE_TO IS NOT NULL)
955: FETCH hstv_stsv_fk1_csr INTO l_hstv_stsv_fk1;
956: l_row_notfound := hstv_stsv_fk1_csr%NOTFOUND;
957: CLOSE hstv_stsv_fk1_csr;
958: IF (l_row_notfound) THEN
959: OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'STS_CODE_TO');
960: RAISE item_not_found_error;
961: END IF;
962: END IF;
963: RETURN (l_return_status);
962: END IF;
963: RETURN (l_return_status);
964: EXCEPTION
965: WHEN item_not_found_error THEN
966: l_return_status := OKC_API.G_RET_STS_ERROR;
967: RETURN (l_return_status);
968: END validate_foreign_keys;
969: BEGIN
970: l_return_status := validate_foreign_keys(p_hstv_rec, p_db_hstv_rec);
972: END Validate_Record;
973: FUNCTION Validate_Record (
974: p_hstv_rec IN hstv_rec_type
975: ) RETURN VARCHAR2 IS
976: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
977: l_db_hstv_rec hstv_rec_type := get_rec(p_hstv_rec);
978: BEGIN
979: l_return_status := Validate_Record(p_hstv_rec => p_hstv_rec,
980: p_db_hstv_rec => l_db_hstv_rec);
1077: p_hstv_rec IN hstv_rec_type) IS
1078:
1079: l_api_version CONSTANT NUMBER := 1;
1080: l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
1081: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1082: l_hstv_rec hstv_rec_type := p_hstv_rec;
1083: l_hst_rec hst_rec_type;
1084: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
1085: BEGIN
1082: l_hstv_rec hstv_rec_type := p_hstv_rec;
1083: l_hst_rec hst_rec_type;
1084: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
1085: BEGIN
1086: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1087: G_PKG_NAME,
1088: p_init_msg_list,
1089: l_api_version,
1090: p_api_version,
1089: l_api_version,
1090: p_api_version,
1091: '_PVT',
1092: x_return_status);
1093: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1094: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1095: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1096: RAISE OKC_API.G_EXCEPTION_ERROR;
1097: END IF;
1090: p_api_version,
1091: '_PVT',
1092: x_return_status);
1093: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1094: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1095: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1096: RAISE OKC_API.G_EXCEPTION_ERROR;
1097: END IF;
1098: --- Validate all non-missing attributes (Item Level Validation)
1091: '_PVT',
1092: x_return_status);
1093: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1094: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1095: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1096: RAISE OKC_API.G_EXCEPTION_ERROR;
1097: END IF;
1098: --- Validate all non-missing attributes (Item Level Validation)
1099: l_return_status := Validate_Attributes(l_hstv_rec);
1092: x_return_status);
1093: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1094: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1095: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1096: RAISE OKC_API.G_EXCEPTION_ERROR;
1097: END IF;
1098: --- Validate all non-missing attributes (Item Level Validation)
1099: l_return_status := Validate_Attributes(l_hstv_rec);
1100: --- If any errors happen abort API
1097: END IF;
1098: --- Validate all non-missing attributes (Item Level Validation)
1099: l_return_status := Validate_Attributes(l_hstv_rec);
1100: --- If any errors happen abort API
1101: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1102: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1103: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1098: --- Validate all non-missing attributes (Item Level Validation)
1099: l_return_status := Validate_Attributes(l_hstv_rec);
1100: --- If any errors happen abort API
1101: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1102: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1103: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1099: l_return_status := Validate_Attributes(l_hstv_rec);
1100: --- If any errors happen abort API
1101: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1102: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1103: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1100: --- If any errors happen abort API
1101: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1102: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1103: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1108: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1103: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1108: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1109: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1110: RAISE OKC_API.G_EXCEPTION_ERROR;
1111: END IF;
1104: RAISE OKC_API.G_EXCEPTION_ERROR;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1108: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1109: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1110: RAISE OKC_API.G_EXCEPTION_ERROR;
1111: END IF;
1112: x_return_status := l_return_status;
1105: END IF;
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1108: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1109: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1110: RAISE OKC_API.G_EXCEPTION_ERROR;
1111: END IF;
1112: x_return_status := l_return_status;
1113: EXCEPTION
1106: l_return_status := Validate_Record(l_hstv_rec);
1107: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1108: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1109: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1110: RAISE OKC_API.G_EXCEPTION_ERROR;
1111: END IF;
1112: x_return_status := l_return_status;
1113: EXCEPTION
1114: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1110: RAISE OKC_API.G_EXCEPTION_ERROR;
1111: END IF;
1112: x_return_status := l_return_status;
1113: EXCEPTION
1114: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1115: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1116: (
1117: l_api_name,
1118: G_PKG_NAME,
1111: END IF;
1112: x_return_status := l_return_status;
1113: EXCEPTION
1114: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1115: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1116: (
1117: l_api_name,
1118: G_PKG_NAME,
1119: 'OKC_API.G_RET_STS_ERROR',
1115: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1116: (
1117: l_api_name,
1118: G_PKG_NAME,
1119: 'OKC_API.G_RET_STS_ERROR',
1120: x_msg_count,
1121: x_msg_data,
1122: '_PVT'
1123: );
1120: x_msg_count,
1121: x_msg_data,
1122: '_PVT'
1123: );
1124: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1125: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1126: (
1127: l_api_name,
1128: G_PKG_NAME,
1121: x_msg_data,
1122: '_PVT'
1123: );
1124: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1125: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1126: (
1127: l_api_name,
1128: G_PKG_NAME,
1129: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1125: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1126: (
1127: l_api_name,
1128: G_PKG_NAME,
1129: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1130: x_msg_count,
1131: x_msg_data,
1132: '_PVT'
1133: );
1131: x_msg_data,
1132: '_PVT'
1133: );
1134: WHEN OTHERS THEN
1135: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1136: (
1137: l_api_name,
1138: G_PKG_NAME,
1139: 'OTHERS',
1151: x_return_status OUT NOCOPY VARCHAR2,
1152: x_msg_count OUT NOCOPY NUMBER,
1153: x_msg_data OUT NOCOPY VARCHAR2,
1154: p_hstv_tbl IN hstv_tbl_type,
1155: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1156:
1157: l_api_version CONSTANT NUMBER := 1;
1158: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_validate_row';
1159: i NUMBER := 0;
1157: l_api_version CONSTANT NUMBER := 1;
1158: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_validate_row';
1159: i NUMBER := 0;
1160: BEGIN
1161: OKC_API.init_msg_list(p_init_msg_list);
1162: -- Make sure PL/SQL table has records in it before passing
1163: IF (p_hstv_tbl.COUNT > 0) THEN
1164: i := p_hstv_tbl.FIRST;
1165: LOOP
1163: IF (p_hstv_tbl.COUNT > 0) THEN
1164: i := p_hstv_tbl.FIRST;
1165: LOOP
1166: DECLARE
1167: l_error_rec OKC_API.ERROR_REC_TYPE;
1168: BEGIN
1169: l_error_rec.api_name := l_api_name;
1170: l_error_rec.api_package := G_PKG_NAME;
1171: l_error_rec.idx := i;
1170: l_error_rec.api_package := G_PKG_NAME;
1171: l_error_rec.idx := i;
1172: validate_row (
1173: p_api_version => p_api_version,
1174: p_init_msg_list => OKC_API.G_FALSE,
1175: x_return_status => l_error_rec.error_type,
1176: x_msg_count => l_error_rec.msg_count,
1177: x_msg_data => l_error_rec.msg_data,
1178: p_hstv_rec => p_hstv_tbl(i));
1175: x_return_status => l_error_rec.error_type,
1176: x_msg_count => l_error_rec.msg_count,
1177: x_msg_data => l_error_rec.msg_data,
1178: p_hstv_rec => p_hstv_tbl(i));
1179: IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1180: l_error_rec.sqlcode := SQLCODE;
1181: load_error_tbl(l_error_rec, px_error_tbl);
1182: ELSE
1183: x_msg_count := l_error_rec.msg_count;
1183: x_msg_count := l_error_rec.msg_count;
1184: x_msg_data := l_error_rec.msg_data;
1185: END IF;
1186: EXCEPTION
1187: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1188: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1189: l_error_rec.sqlcode := SQLCODE;
1190: load_error_tbl(l_error_rec, px_error_tbl);
1191: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1184: x_msg_data := l_error_rec.msg_data;
1185: END IF;
1186: EXCEPTION
1187: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1188: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1189: l_error_rec.sqlcode := SQLCODE;
1190: load_error_tbl(l_error_rec, px_error_tbl);
1191: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1192: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1187: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1188: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1189: l_error_rec.sqlcode := SQLCODE;
1190: load_error_tbl(l_error_rec, px_error_tbl);
1191: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1192: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1193: l_error_rec.sqlcode := SQLCODE;
1194: load_error_tbl(l_error_rec, px_error_tbl);
1195: WHEN OTHERS THEN
1188: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1189: l_error_rec.sqlcode := SQLCODE;
1190: load_error_tbl(l_error_rec, px_error_tbl);
1191: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1192: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1193: l_error_rec.sqlcode := SQLCODE;
1194: load_error_tbl(l_error_rec, px_error_tbl);
1195: WHEN OTHERS THEN
1196: l_error_rec.error_type := 'OTHERS';
1203: END IF;
1204: -- Loop through the error_tbl to find the error with the highest severity
1205: -- and return it.
1206: x_return_status := find_highest_exception(px_error_tbl);
1207: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1208: EXCEPTION
1209: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1210: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1211: (
1205: -- and return it.
1206: x_return_status := find_highest_exception(px_error_tbl);
1207: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1208: EXCEPTION
1209: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1210: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1211: (
1212: l_api_name,
1213: G_PKG_NAME,
1206: x_return_status := find_highest_exception(px_error_tbl);
1207: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1208: EXCEPTION
1209: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1210: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1211: (
1212: l_api_name,
1213: G_PKG_NAME,
1214: 'OKC_API.G_RET_STS_ERROR',
1210: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1211: (
1212: l_api_name,
1213: G_PKG_NAME,
1214: 'OKC_API.G_RET_STS_ERROR',
1215: x_msg_count,
1216: x_msg_data,
1217: '_PVT'
1218: );
1215: x_msg_count,
1216: x_msg_data,
1217: '_PVT'
1218: );
1219: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1220: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1221: (
1222: l_api_name,
1223: G_PKG_NAME,
1216: x_msg_data,
1217: '_PVT'
1218: );
1219: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1220: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1221: (
1222: l_api_name,
1223: G_PKG_NAME,
1224: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1220: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1221: (
1222: l_api_name,
1223: G_PKG_NAME,
1224: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1225: x_msg_count,
1226: x_msg_data,
1227: '_PVT'
1228: );
1226: x_msg_data,
1227: '_PVT'
1228: );
1229: WHEN OTHERS THEN
1230: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1231: (
1232: l_api_name,
1233: G_PKG_NAME,
1234: 'OTHERS',
1250: p_hstv_tbl IN hstv_tbl_type) IS
1251:
1252: l_api_version CONSTANT NUMBER := 1;
1253: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1254: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1255: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1256: BEGIN
1257: OKC_API.init_msg_list(p_init_msg_list);
1258: -- Make sure PL/SQL table has records in it before passing
1251:
1252: l_api_version CONSTANT NUMBER := 1;
1253: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1254: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1255: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1256: BEGIN
1257: OKC_API.init_msg_list(p_init_msg_list);
1258: -- Make sure PL/SQL table has records in it before passing
1259: IF (p_hstv_tbl.COUNT > 0) THEN
1253: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1254: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1255: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1256: BEGIN
1257: OKC_API.init_msg_list(p_init_msg_list);
1258: -- Make sure PL/SQL table has records in it before passing
1259: IF (p_hstv_tbl.COUNT > 0) THEN
1260: validate_row (
1261: p_api_version => p_api_version,
1258: -- Make sure PL/SQL table has records in it before passing
1259: IF (p_hstv_tbl.COUNT > 0) THEN
1260: validate_row (
1261: p_api_version => p_api_version,
1262: p_init_msg_list => OKC_API.G_FALSE,
1263: x_return_status => x_return_status,
1264: x_msg_count => x_msg_count,
1265: x_msg_data => x_msg_data,
1266: p_hstv_tbl => p_hstv_tbl,
1265: x_msg_data => x_msg_data,
1266: p_hstv_tbl => p_hstv_tbl,
1267: px_error_tbl => l_error_tbl);
1268: END IF;
1269: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1270: EXCEPTION
1271: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1272: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1273: (
1267: px_error_tbl => l_error_tbl);
1268: END IF;
1269: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1270: EXCEPTION
1271: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1272: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1273: (
1274: l_api_name,
1275: G_PKG_NAME,
1268: END IF;
1269: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1270: EXCEPTION
1271: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1272: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1273: (
1274: l_api_name,
1275: G_PKG_NAME,
1276: 'OKC_API.G_RET_STS_ERROR',
1272: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1273: (
1274: l_api_name,
1275: G_PKG_NAME,
1276: 'OKC_API.G_RET_STS_ERROR',
1277: x_msg_count,
1278: x_msg_data,
1279: '_PVT'
1280: );
1277: x_msg_count,
1278: x_msg_data,
1279: '_PVT'
1280: );
1281: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1282: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1283: (
1284: l_api_name,
1285: G_PKG_NAME,
1278: x_msg_data,
1279: '_PVT'
1280: );
1281: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1282: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1283: (
1284: l_api_name,
1285: G_PKG_NAME,
1286: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1282: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1283: (
1284: l_api_name,
1285: G_PKG_NAME,
1286: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1287: x_msg_count,
1288: x_msg_data,
1289: '_PVT'
1290: );
1288: x_msg_data,
1289: '_PVT'
1290: );
1291: WHEN OTHERS THEN
1292: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1293: (
1294: l_api_name,
1295: G_PKG_NAME,
1296: 'OTHERS',
1315: x_hst_rec OUT NOCOPY hst_rec_type) IS
1316:
1317: l_api_version CONSTANT NUMBER := 1;
1318: l_api_name CONSTANT VARCHAR2(30) := 'B_insert_row';
1319: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1320: l_hst_rec hst_rec_type := p_hst_rec;
1321: l_def_hst_rec hst_rec_type;
1322: ----------------------------------------
1323: -- Set_Attributes for:OKC_K_HISTORY_B --
1325: FUNCTION Set_Attributes (
1326: p_hst_rec IN hst_rec_type,
1327: x_hst_rec OUT NOCOPY hst_rec_type
1328: ) RETURN VARCHAR2 IS
1329: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1330: BEGIN
1331: x_hst_rec := p_hst_rec;
1332: RETURN(l_return_status);
1333: END Set_Attributes;
1331: x_hst_rec := p_hst_rec;
1332: RETURN(l_return_status);
1333: END Set_Attributes;
1334: BEGIN
1335: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1336: p_init_msg_list,
1337: '_PVT',
1338: x_return_status);
1339: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1335: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1336: p_init_msg_list,
1337: '_PVT',
1338: x_return_status);
1339: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1340: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1341: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1342: RAISE OKC_API.G_EXCEPTION_ERROR;
1343: END IF;
1336: p_init_msg_list,
1337: '_PVT',
1338: x_return_status);
1339: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1340: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1341: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1342: RAISE OKC_API.G_EXCEPTION_ERROR;
1343: END IF;
1344: --- Setting item atributes
1337: '_PVT',
1338: x_return_status);
1339: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1340: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1341: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1342: RAISE OKC_API.G_EXCEPTION_ERROR;
1343: END IF;
1344: --- Setting item atributes
1345: l_return_status := Set_Attributes(
1338: x_return_status);
1339: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1340: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1341: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1342: RAISE OKC_API.G_EXCEPTION_ERROR;
1343: END IF;
1344: --- Setting item atributes
1345: l_return_status := Set_Attributes(
1346: p_hst_rec, -- IN
1345: l_return_status := Set_Attributes(
1346: p_hst_rec, -- IN
1347: l_hst_rec); -- OUT
1348: --- If any errors happen abort API
1349: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1350: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1351: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1352: RAISE OKC_API.G_EXCEPTION_ERROR;
1353: END IF;
1346: p_hst_rec, -- IN
1347: l_hst_rec); -- OUT
1348: --- If any errors happen abort API
1349: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1350: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1351: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1352: RAISE OKC_API.G_EXCEPTION_ERROR;
1353: END IF;
1354: INSERT INTO OKC_K_HISTORY_B(
1347: l_hst_rec); -- OUT
1348: --- If any errors happen abort API
1349: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1350: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1351: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1352: RAISE OKC_API.G_EXCEPTION_ERROR;
1353: END IF;
1354: INSERT INTO OKC_K_HISTORY_B(
1355: id,
1348: --- If any errors happen abort API
1349: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1350: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1351: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1352: RAISE OKC_API.G_EXCEPTION_ERROR;
1353: END IF;
1354: INSERT INTO OKC_K_HISTORY_B(
1355: id,
1356: chr_id,
1395: l_hst_rec.request_id);
1396: -- Set OUT values
1397: x_hst_rec := l_hst_rec;
1398: x_return_status := l_return_status;
1399: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1400: EXCEPTION
1401: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1402: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1403: (
1397: x_hst_rec := l_hst_rec;
1398: x_return_status := l_return_status;
1399: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1400: EXCEPTION
1401: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1402: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1403: (
1404: l_api_name,
1405: G_PKG_NAME,
1398: x_return_status := l_return_status;
1399: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1400: EXCEPTION
1401: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1402: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1403: (
1404: l_api_name,
1405: G_PKG_NAME,
1406: 'OKC_API.G_RET_STS_ERROR',
1402: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1403: (
1404: l_api_name,
1405: G_PKG_NAME,
1406: 'OKC_API.G_RET_STS_ERROR',
1407: x_msg_count,
1408: x_msg_data,
1409: '_PVT'
1410: );
1407: x_msg_count,
1408: x_msg_data,
1409: '_PVT'
1410: );
1411: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1412: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1413: (
1414: l_api_name,
1415: G_PKG_NAME,
1408: x_msg_data,
1409: '_PVT'
1410: );
1411: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1412: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1413: (
1414: l_api_name,
1415: G_PKG_NAME,
1416: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1412: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1413: (
1414: l_api_name,
1415: G_PKG_NAME,
1416: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1417: x_msg_count,
1418: x_msg_data,
1419: '_PVT'
1420: );
1418: x_msg_data,
1419: '_PVT'
1420: );
1421: WHEN OTHERS THEN
1422: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1423: (
1424: l_api_name,
1425: G_PKG_NAME,
1426: 'OTHERS',
1441: x_okc_k_history_tl_rec OUT NOCOPY okc_k_history_tl_rec_type) IS
1442:
1443: l_api_version CONSTANT NUMBER := 1;
1444: l_api_name CONSTANT VARCHAR2(30) := 'TL_insert_row';
1445: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1446: l_okc_k_history_tl_rec okc_k_history_tl_rec_type := p_okc_k_history_tl_rec;
1447: l_def_okc_k_history_tl_rec okc_k_history_tl_rec_type;
1448: CURSOR get_languages IS
1449: SELECT *
1455: FUNCTION Set_Attributes (
1456: p_okc_k_history_tl_rec IN okc_k_history_tl_rec_type,
1457: x_okc_k_history_tl_rec OUT NOCOPY okc_k_history_tl_rec_type
1458: ) RETURN VARCHAR2 IS
1459: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1460: BEGIN
1461: x_okc_k_history_tl_rec := p_okc_k_history_tl_rec;
1462: x_okc_k_history_tl_rec.LANGUAGE := USERENV('LANG');
1463: x_okc_k_history_tl_rec.SOURCE_LANG := USERENV('LANG');
1463: x_okc_k_history_tl_rec.SOURCE_LANG := USERENV('LANG');
1464: RETURN(l_return_status);
1465: END Set_Attributes;
1466: BEGIN
1467: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1468: p_init_msg_list,
1469: '_PVT',
1470: x_return_status);
1471: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1467: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1468: p_init_msg_list,
1469: '_PVT',
1470: x_return_status);
1471: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1472: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1473: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1474: RAISE OKC_API.G_EXCEPTION_ERROR;
1475: END IF;
1468: p_init_msg_list,
1469: '_PVT',
1470: x_return_status);
1471: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1472: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1473: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1474: RAISE OKC_API.G_EXCEPTION_ERROR;
1475: END IF;
1476: --- Setting item attributes
1469: '_PVT',
1470: x_return_status);
1471: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1472: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1473: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1474: RAISE OKC_API.G_EXCEPTION_ERROR;
1475: END IF;
1476: --- Setting item attributes
1477: l_return_status := Set_Attributes(
1470: x_return_status);
1471: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1472: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1473: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1474: RAISE OKC_API.G_EXCEPTION_ERROR;
1475: END IF;
1476: --- Setting item attributes
1477: l_return_status := Set_Attributes(
1478: p_okc_k_history_tl_rec, -- IN
1477: l_return_status := Set_Attributes(
1478: p_okc_k_history_tl_rec, -- IN
1479: l_okc_k_history_tl_rec); -- OUT
1480: --- If any errors happen abort API
1481: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1482: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1483: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1484: RAISE OKC_API.G_EXCEPTION_ERROR;
1485: END IF;
1478: p_okc_k_history_tl_rec, -- IN
1479: l_okc_k_history_tl_rec); -- OUT
1480: --- If any errors happen abort API
1481: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1482: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1483: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1484: RAISE OKC_API.G_EXCEPTION_ERROR;
1485: END IF;
1486: FOR l_lang_rec IN get_languages LOOP
1479: l_okc_k_history_tl_rec); -- OUT
1480: --- If any errors happen abort API
1481: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1482: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1483: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1484: RAISE OKC_API.G_EXCEPTION_ERROR;
1485: END IF;
1486: FOR l_lang_rec IN get_languages LOOP
1487: l_okc_k_history_tl_rec.language := l_lang_rec.language_code;
1480: --- If any errors happen abort API
1481: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1482: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1483: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1484: RAISE OKC_API.G_EXCEPTION_ERROR;
1485: END IF;
1486: FOR l_lang_rec IN get_languages LOOP
1487: l_okc_k_history_tl_rec.language := l_lang_rec.language_code;
1488: INSERT INTO OKC_K_HISTORY_TL(
1508: END LOOP;
1509: -- Set OUT values
1510: x_okc_k_history_tl_rec := l_okc_k_history_tl_rec;
1511: x_return_status := l_return_status;
1512: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1513: EXCEPTION
1514: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1515: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1516: (
1510: x_okc_k_history_tl_rec := l_okc_k_history_tl_rec;
1511: x_return_status := l_return_status;
1512: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1513: EXCEPTION
1514: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1515: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1516: (
1517: l_api_name,
1518: G_PKG_NAME,
1511: x_return_status := l_return_status;
1512: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1513: EXCEPTION
1514: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1515: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1516: (
1517: l_api_name,
1518: G_PKG_NAME,
1519: 'OKC_API.G_RET_STS_ERROR',
1515: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1516: (
1517: l_api_name,
1518: G_PKG_NAME,
1519: 'OKC_API.G_RET_STS_ERROR',
1520: x_msg_count,
1521: x_msg_data,
1522: '_PVT'
1523: );
1520: x_msg_count,
1521: x_msg_data,
1522: '_PVT'
1523: );
1524: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1525: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1526: (
1527: l_api_name,
1528: G_PKG_NAME,
1521: x_msg_data,
1522: '_PVT'
1523: );
1524: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1525: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1526: (
1527: l_api_name,
1528: G_PKG_NAME,
1529: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1525: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1526: (
1527: l_api_name,
1528: G_PKG_NAME,
1529: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1530: x_msg_count,
1531: x_msg_data,
1532: '_PVT'
1533: );
1531: x_msg_data,
1532: '_PVT'
1533: );
1534: WHEN OTHERS THEN
1535: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1536: (
1537: l_api_name,
1538: G_PKG_NAME,
1539: 'OTHERS',
1555: x_hstv_rec OUT NOCOPY hstv_rec_type) IS
1556:
1557: l_api_version CONSTANT NUMBER := 1;
1558: l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
1559: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1560: l_hstv_rec hstv_rec_type := p_hstv_rec;
1561: l_def_hstv_rec hstv_rec_type;
1562: l_hst_rec hst_rec_type;
1563: lx_hst_rec hst_rec_type;
1584: FUNCTION Set_Attributes (
1585: p_hstv_rec IN hstv_rec_type,
1586: x_hstv_rec OUT NOCOPY hstv_rec_type
1587: ) RETURN VARCHAR2 IS
1588: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1589: l_trn_code VARCHAR2(30);
1590:
1591: CURSOR terminate_csr IS
1592: SELECT trn_code
1629:
1630: RETURN(l_return_status);
1631: END Set_Attributes;
1632: BEGIN
1633: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1634: G_PKG_NAME,
1635: p_init_msg_list,
1636: l_api_version,
1637: p_api_version,
1636: l_api_version,
1637: p_api_version,
1638: '_PVT',
1639: x_return_status);
1640: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1641: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1642: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1643: RAISE OKC_API.G_EXCEPTION_ERROR;
1644: END IF;
1637: p_api_version,
1638: '_PVT',
1639: x_return_status);
1640: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1641: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1642: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1643: RAISE OKC_API.G_EXCEPTION_ERROR;
1644: END IF;
1645:
1638: '_PVT',
1639: x_return_status);
1640: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1641: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1642: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1643: RAISE OKC_API.G_EXCEPTION_ERROR;
1644: END IF;
1645:
1646: l_hstv_rec := null_out_defaults(p_hstv_rec);
1639: x_return_status);
1640: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1641: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1642: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1643: RAISE OKC_API.G_EXCEPTION_ERROR;
1644: END IF;
1645:
1646: l_hstv_rec := null_out_defaults(p_hstv_rec);
1647: -- Set primary key value
1650: l_return_Status := Set_Attributes(
1651: l_hstv_rec, -- IN
1652: l_def_hstv_rec); -- OUT
1653: --- If any errors happen abort API
1654: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1655: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1656: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1657: RAISE OKC_API.G_EXCEPTION_ERROR;
1658: END IF;
1651: l_hstv_rec, -- IN
1652: l_def_hstv_rec); -- OUT
1653: --- If any errors happen abort API
1654: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1655: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1656: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1657: RAISE OKC_API.G_EXCEPTION_ERROR;
1658: END IF;
1659: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
1652: l_def_hstv_rec); -- OUT
1653: --- If any errors happen abort API
1654: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1655: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1656: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1657: RAISE OKC_API.G_EXCEPTION_ERROR;
1658: END IF;
1659: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
1660: --- Validate all non-missing attributes (Item Level Validation)
1653: --- If any errors happen abort API
1654: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1655: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1656: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1657: RAISE OKC_API.G_EXCEPTION_ERROR;
1658: END IF;
1659: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
1660: --- Validate all non-missing attributes (Item Level Validation)
1661: l_return_status := Validate_Attributes(l_def_hstv_rec);
1659: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
1660: --- Validate all non-missing attributes (Item Level Validation)
1661: l_return_status := Validate_Attributes(l_def_hstv_rec);
1662: --- If any errors happen abort API
1663: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1664: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1665: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1660: --- Validate all non-missing attributes (Item Level Validation)
1661: l_return_status := Validate_Attributes(l_def_hstv_rec);
1662: --- If any errors happen abort API
1663: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1664: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1665: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1661: l_return_status := Validate_Attributes(l_def_hstv_rec);
1662: --- If any errors happen abort API
1663: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1664: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1665: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1662: --- If any errors happen abort API
1663: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1664: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1665: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1665: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1672: RAISE OKC_API.G_EXCEPTION_ERROR;
1673: END IF;
1666: RAISE OKC_API.G_EXCEPTION_ERROR;
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1672: RAISE OKC_API.G_EXCEPTION_ERROR;
1673: END IF;
1674: -----------------------------------------
1667: END IF;
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1672: RAISE OKC_API.G_EXCEPTION_ERROR;
1673: END IF;
1674: -----------------------------------------
1675: -- Move VIEW record to "Child" records --
1668: l_return_status := Validate_Record(l_def_hstv_rec);
1669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1672: RAISE OKC_API.G_EXCEPTION_ERROR;
1673: END IF;
1674: -----------------------------------------
1675: -- Move VIEW record to "Child" records --
1676: -----------------------------------------
1686: x_msg_data,
1687: l_hst_rec,
1688: lx_hst_rec
1689: );
1690: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1691: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1692: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1693: RAISE OKC_API.G_EXCEPTION_ERROR;
1694: END IF;
1687: l_hst_rec,
1688: lx_hst_rec
1689: );
1690: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1691: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1692: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1693: RAISE OKC_API.G_EXCEPTION_ERROR;
1694: END IF;
1695: migrate(lx_hst_rec, l_def_hstv_rec);
1688: lx_hst_rec
1689: );
1690: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1691: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1692: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1693: RAISE OKC_API.G_EXCEPTION_ERROR;
1694: END IF;
1695: migrate(lx_hst_rec, l_def_hstv_rec);
1696: insert_row(
1689: );
1690: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1691: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1692: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1693: RAISE OKC_API.G_EXCEPTION_ERROR;
1694: END IF;
1695: migrate(lx_hst_rec, l_def_hstv_rec);
1696: insert_row(
1697: p_init_msg_list,
1700: x_msg_data,
1701: l_okc_k_history_tl_rec,
1702: lx_okc_k_history_tl_rec
1703: );
1704: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1705: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1706: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1707: RAISE OKC_API.G_EXCEPTION_ERROR;
1708: END IF;
1701: l_okc_k_history_tl_rec,
1702: lx_okc_k_history_tl_rec
1703: );
1704: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1705: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1706: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1707: RAISE OKC_API.G_EXCEPTION_ERROR;
1708: END IF;
1709: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
1702: lx_okc_k_history_tl_rec
1703: );
1704: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1705: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1706: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1707: RAISE OKC_API.G_EXCEPTION_ERROR;
1708: END IF;
1709: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
1710: -- Set OUT values
1703: );
1704: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1705: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1706: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1707: RAISE OKC_API.G_EXCEPTION_ERROR;
1708: END IF;
1709: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
1710: -- Set OUT values
1711: x_hstv_rec := l_def_hstv_rec;
1709: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
1710: -- Set OUT values
1711: x_hstv_rec := l_def_hstv_rec;
1712: x_return_status := l_return_status;
1713: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1714: EXCEPTION
1715: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1716: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1717: (
1711: x_hstv_rec := l_def_hstv_rec;
1712: x_return_status := l_return_status;
1713: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1714: EXCEPTION
1715: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1716: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1717: (
1718: l_api_name,
1719: G_PKG_NAME,
1712: x_return_status := l_return_status;
1713: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1714: EXCEPTION
1715: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1716: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1717: (
1718: l_api_name,
1719: G_PKG_NAME,
1720: 'OKC_API.G_RET_STS_ERROR',
1716: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1717: (
1718: l_api_name,
1719: G_PKG_NAME,
1720: 'OKC_API.G_RET_STS_ERROR',
1721: x_msg_count,
1722: x_msg_data,
1723: '_PVT'
1724: );
1721: x_msg_count,
1722: x_msg_data,
1723: '_PVT'
1724: );
1725: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1726: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1727: (
1728: l_api_name,
1729: G_PKG_NAME,
1722: x_msg_data,
1723: '_PVT'
1724: );
1725: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1726: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1727: (
1728: l_api_name,
1729: G_PKG_NAME,
1730: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1726: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1727: (
1728: l_api_name,
1729: G_PKG_NAME,
1730: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1731: x_msg_count,
1732: x_msg_data,
1733: '_PVT'
1734: );
1732: x_msg_data,
1733: '_PVT'
1734: );
1735: WHEN OTHERS THEN
1736: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1737: (
1738: l_api_name,
1739: G_PKG_NAME,
1740: 'OTHERS',
1753: x_msg_count OUT NOCOPY NUMBER,
1754: x_msg_data OUT NOCOPY VARCHAR2,
1755: p_hstv_tbl IN hstv_tbl_type,
1756: x_hstv_tbl OUT NOCOPY hstv_tbl_type,
1757: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1758:
1759: l_api_version CONSTANT NUMBER := 1;
1760: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_insert_row';
1761: i NUMBER := 0;
1759: l_api_version CONSTANT NUMBER := 1;
1760: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_insert_row';
1761: i NUMBER := 0;
1762: BEGIN
1763: OKC_API.init_msg_list(p_init_msg_list);
1764: -- Make sure PL/SQL table has records in it before passing
1765: IF (p_hstv_tbl.COUNT > 0) THEN
1766: i := p_hstv_tbl.FIRST;
1767: LOOP
1765: IF (p_hstv_tbl.COUNT > 0) THEN
1766: i := p_hstv_tbl.FIRST;
1767: LOOP
1768: DECLARE
1769: l_error_rec OKC_API.ERROR_REC_TYPE;
1770: BEGIN
1771: l_error_rec.api_name := l_api_name;
1772: l_error_rec.api_package := G_PKG_NAME;
1773: l_error_rec.idx := i;
1772: l_error_rec.api_package := G_PKG_NAME;
1773: l_error_rec.idx := i;
1774: insert_row (
1775: p_api_version => p_api_version,
1776: p_init_msg_list => OKC_API.G_FALSE,
1777: x_return_status => l_error_rec.error_type,
1778: x_msg_count => l_error_rec.msg_count,
1779: x_msg_data => l_error_rec.msg_data,
1780: p_hstv_rec => p_hstv_tbl(i),
1778: x_msg_count => l_error_rec.msg_count,
1779: x_msg_data => l_error_rec.msg_data,
1780: p_hstv_rec => p_hstv_tbl(i),
1781: x_hstv_rec => x_hstv_tbl(i));
1782: IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1783: l_error_rec.sqlcode := SQLCODE;
1784: load_error_tbl(l_error_rec, px_error_tbl);
1785: ELSE
1786: x_msg_count := l_error_rec.msg_count;
1786: x_msg_count := l_error_rec.msg_count;
1787: x_msg_data := l_error_rec.msg_data;
1788: END IF;
1789: EXCEPTION
1790: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1791: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1792: l_error_rec.sqlcode := SQLCODE;
1793: load_error_tbl(l_error_rec, px_error_tbl);
1794: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1787: x_msg_data := l_error_rec.msg_data;
1788: END IF;
1789: EXCEPTION
1790: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1791: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1792: l_error_rec.sqlcode := SQLCODE;
1793: load_error_tbl(l_error_rec, px_error_tbl);
1794: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1795: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1790: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1791: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1792: l_error_rec.sqlcode := SQLCODE;
1793: load_error_tbl(l_error_rec, px_error_tbl);
1794: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1795: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1796: l_error_rec.sqlcode := SQLCODE;
1797: load_error_tbl(l_error_rec, px_error_tbl);
1798: WHEN OTHERS THEN
1791: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1792: l_error_rec.sqlcode := SQLCODE;
1793: load_error_tbl(l_error_rec, px_error_tbl);
1794: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1795: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1796: l_error_rec.sqlcode := SQLCODE;
1797: load_error_tbl(l_error_rec, px_error_tbl);
1798: WHEN OTHERS THEN
1799: l_error_rec.error_type := 'OTHERS';
1806: END IF;
1807: -- Loop through the error_tbl to find the error with the highest severity
1808: -- and return it.
1809: x_return_status := find_highest_exception(px_error_tbl);
1810: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1811: EXCEPTION
1812: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1813: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1814: (
1808: -- and return it.
1809: x_return_status := find_highest_exception(px_error_tbl);
1810: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1811: EXCEPTION
1812: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1813: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1814: (
1815: l_api_name,
1816: G_PKG_NAME,
1809: x_return_status := find_highest_exception(px_error_tbl);
1810: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1811: EXCEPTION
1812: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1813: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1814: (
1815: l_api_name,
1816: G_PKG_NAME,
1817: 'OKC_API.G_RET_STS_ERROR',
1813: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1814: (
1815: l_api_name,
1816: G_PKG_NAME,
1817: 'OKC_API.G_RET_STS_ERROR',
1818: x_msg_count,
1819: x_msg_data,
1820: '_PVT'
1821: );
1818: x_msg_count,
1819: x_msg_data,
1820: '_PVT'
1821: );
1822: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1823: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1824: (
1825: l_api_name,
1826: G_PKG_NAME,
1819: x_msg_data,
1820: '_PVT'
1821: );
1822: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1823: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1824: (
1825: l_api_name,
1826: G_PKG_NAME,
1827: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1823: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1824: (
1825: l_api_name,
1826: G_PKG_NAME,
1827: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1828: x_msg_count,
1829: x_msg_data,
1830: '_PVT'
1831: );
1829: x_msg_data,
1830: '_PVT'
1831: );
1832: WHEN OTHERS THEN
1833: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1834: (
1835: l_api_name,
1836: G_PKG_NAME,
1837: 'OTHERS',
1854: x_hstv_tbl OUT NOCOPY hstv_tbl_type) IS
1855:
1856: l_api_version CONSTANT NUMBER := 1;
1857: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1858: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1859: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1860: BEGIN
1861: OKC_API.init_msg_list(p_init_msg_list);
1862: -- Make sure PL/SQL table has records in it before passing
1855:
1856: l_api_version CONSTANT NUMBER := 1;
1857: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1858: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1859: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1860: BEGIN
1861: OKC_API.init_msg_list(p_init_msg_list);
1862: -- Make sure PL/SQL table has records in it before passing
1863: IF (p_hstv_tbl.COUNT > 0) THEN
1857: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1858: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1859: l_error_tbl OKC_API.ERROR_TBL_TYPE;
1860: BEGIN
1861: OKC_API.init_msg_list(p_init_msg_list);
1862: -- Make sure PL/SQL table has records in it before passing
1863: IF (p_hstv_tbl.COUNT > 0) THEN
1864: insert_row (
1865: p_api_version => p_api_version,
1862: -- Make sure PL/SQL table has records in it before passing
1863: IF (p_hstv_tbl.COUNT > 0) THEN
1864: insert_row (
1865: p_api_version => p_api_version,
1866: p_init_msg_list => OKC_API.G_FALSE,
1867: x_return_status => x_return_status,
1868: x_msg_count => x_msg_count,
1869: x_msg_data => x_msg_data,
1870: p_hstv_tbl => p_hstv_tbl,
1870: p_hstv_tbl => p_hstv_tbl,
1871: x_hstv_tbl => x_hstv_tbl,
1872: px_error_tbl => l_error_tbl);
1873: END IF;
1874: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1875: EXCEPTION
1876: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1877: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1878: (
1872: px_error_tbl => l_error_tbl);
1873: END IF;
1874: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1875: EXCEPTION
1876: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1877: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1878: (
1879: l_api_name,
1880: G_PKG_NAME,
1873: END IF;
1874: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1875: EXCEPTION
1876: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1877: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1878: (
1879: l_api_name,
1880: G_PKG_NAME,
1881: 'OKC_API.G_RET_STS_ERROR',
1877: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1878: (
1879: l_api_name,
1880: G_PKG_NAME,
1881: 'OKC_API.G_RET_STS_ERROR',
1882: x_msg_count,
1883: x_msg_data,
1884: '_PVT'
1885: );
1882: x_msg_count,
1883: x_msg_data,
1884: '_PVT'
1885: );
1886: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1887: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1888: (
1889: l_api_name,
1890: G_PKG_NAME,
1883: x_msg_data,
1884: '_PVT'
1885: );
1886: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1887: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1888: (
1889: l_api_name,
1890: G_PKG_NAME,
1891: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1887: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1888: (
1889: l_api_name,
1890: G_PKG_NAME,
1891: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1892: x_msg_count,
1893: x_msg_data,
1894: '_PVT'
1895: );
1893: x_msg_data,
1894: '_PVT'
1895: );
1896: WHEN OTHERS THEN
1897: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1898: (
1899: l_api_name,
1900: G_PKG_NAME,
1901: 'OTHERS',
1932: FROM OKC_K_HISTORY_B
1933: WHERE ID = p_hst_rec.id;
1934: l_api_version CONSTANT NUMBER := 1;
1935: l_api_name CONSTANT VARCHAR2(30) := 'B_lock_row';
1936: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1937: l_object_version_number OKC_K_HISTORY_B.OBJECT_VERSION_NUMBER%TYPE;
1938: lc_object_version_number OKC_K_HISTORY_B.OBJECT_VERSION_NUMBER%TYPE;
1939: l_row_notfound BOOLEAN := FALSE;
1940: lc_row_notfound BOOLEAN := FALSE;
1938: lc_object_version_number OKC_K_HISTORY_B.OBJECT_VERSION_NUMBER%TYPE;
1939: l_row_notfound BOOLEAN := FALSE;
1940: lc_row_notfound BOOLEAN := FALSE;
1941: BEGIN
1942: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1943: p_init_msg_list,
1944: '_PVT',
1945: x_return_status);
1946: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1942: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1943: p_init_msg_list,
1944: '_PVT',
1945: x_return_status);
1946: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1947: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1948: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1949: RAISE OKC_API.G_EXCEPTION_ERROR;
1950: END IF;
1943: p_init_msg_list,
1944: '_PVT',
1945: x_return_status);
1946: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1947: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1948: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1949: RAISE OKC_API.G_EXCEPTION_ERROR;
1950: END IF;
1951: BEGIN
1944: '_PVT',
1945: x_return_status);
1946: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1947: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1948: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1949: RAISE OKC_API.G_EXCEPTION_ERROR;
1950: END IF;
1951: BEGIN
1952: OPEN lock_csr(p_hst_rec);
1945: x_return_status);
1946: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1947: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1948: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1949: RAISE OKC_API.G_EXCEPTION_ERROR;
1950: END IF;
1951: BEGIN
1952: OPEN lock_csr(p_hst_rec);
1953: FETCH lock_csr INTO l_object_version_number;
1957: WHEN E_Resource_Busy THEN
1958: IF (lock_csr%ISOPEN) THEN
1959: CLOSE lock_csr;
1960: END IF;
1961: OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
1962: RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
1963: END;
1964:
1965: IF ( l_row_notfound ) THEN
1968: lc_row_notfound := lchk_csr%NOTFOUND;
1969: CLOSE lchk_csr;
1970: END IF;
1971: IF (lc_row_notfound) THEN
1972: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1973: RAISE OKC_API.G_EXCEPTION_ERROR;
1974: ELSIF lc_object_version_number > p_hst_rec.object_version_number THEN
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1969: CLOSE lchk_csr;
1970: END IF;
1971: IF (lc_row_notfound) THEN
1972: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1973: RAISE OKC_API.G_EXCEPTION_ERROR;
1974: ELSIF lc_object_version_number > p_hst_rec.object_version_number THEN
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1971: IF (lc_row_notfound) THEN
1972: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1973: RAISE OKC_API.G_EXCEPTION_ERROR;
1974: ELSIF lc_object_version_number > p_hst_rec.object_version_number THEN
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1972: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1973: RAISE OKC_API.G_EXCEPTION_ERROR;
1974: ELSIF lc_object_version_number > p_hst_rec.object_version_number THEN
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1980: ELSIF lc_object_version_number = -1 THEN
1974: ELSIF lc_object_version_number > p_hst_rec.object_version_number THEN
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1980: ELSIF lc_object_version_number = -1 THEN
1981: OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1982: RAISE OKC_API.G_EXCEPTION_ERROR;
1975: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1976: RAISE OKC_API.G_EXCEPTION_ERROR;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1980: ELSIF lc_object_version_number = -1 THEN
1981: OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1982: RAISE OKC_API.G_EXCEPTION_ERROR;
1983: END IF;
1977: ELSIF lc_object_version_number <> p_hst_rec.object_version_number THEN
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1980: ELSIF lc_object_version_number = -1 THEN
1981: OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1982: RAISE OKC_API.G_EXCEPTION_ERROR;
1983: END IF;
1984: x_return_status := l_return_status;
1985: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1978: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1979: RAISE OKC_API.G_EXCEPTION_ERROR;
1980: ELSIF lc_object_version_number = -1 THEN
1981: OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1982: RAISE OKC_API.G_EXCEPTION_ERROR;
1983: END IF;
1984: x_return_status := l_return_status;
1985: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1986: EXCEPTION
1981: OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1982: RAISE OKC_API.G_EXCEPTION_ERROR;
1983: END IF;
1984: x_return_status := l_return_status;
1985: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1986: EXCEPTION
1987: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1989: (
1983: END IF;
1984: x_return_status := l_return_status;
1985: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1986: EXCEPTION
1987: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1989: (
1990: l_api_name,
1991: G_PKG_NAME,
1984: x_return_status := l_return_status;
1985: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1986: EXCEPTION
1987: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1989: (
1990: l_api_name,
1991: G_PKG_NAME,
1992: 'OKC_API.G_RET_STS_ERROR',
1988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1989: (
1990: l_api_name,
1991: G_PKG_NAME,
1992: 'OKC_API.G_RET_STS_ERROR',
1993: x_msg_count,
1994: x_msg_data,
1995: '_PVT'
1996: );
1993: x_msg_count,
1994: x_msg_data,
1995: '_PVT'
1996: );
1997: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1998: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1999: (
2000: l_api_name,
2001: G_PKG_NAME,
1994: x_msg_data,
1995: '_PVT'
1996: );
1997: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1998: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1999: (
2000: l_api_name,
2001: G_PKG_NAME,
2002: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1998: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1999: (
2000: l_api_name,
2001: G_PKG_NAME,
2002: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2003: x_msg_count,
2004: x_msg_data,
2005: '_PVT'
2006: );
2004: x_msg_data,
2005: '_PVT'
2006: );
2007: WHEN OTHERS THEN
2008: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2009: (
2010: l_api_name,
2011: G_PKG_NAME,
2012: 'OTHERS',
2034: FOR UPDATE NOWAIT;
2035:
2036: l_api_version CONSTANT NUMBER := 1;
2037: l_api_name CONSTANT VARCHAR2(30) := 'TL_lock_row';
2038: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2039: l_lock_var lock_csr%ROWTYPE;
2040: l_row_notfound BOOLEAN := FALSE;
2041: lc_row_notfound BOOLEAN := FALSE;
2042: BEGIN
2039: l_lock_var lock_csr%ROWTYPE;
2040: l_row_notfound BOOLEAN := FALSE;
2041: lc_row_notfound BOOLEAN := FALSE;
2042: BEGIN
2043: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2044: p_init_msg_list,
2045: '_PVT',
2046: x_return_status);
2047: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2043: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2044: p_init_msg_list,
2045: '_PVT',
2046: x_return_status);
2047: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2048: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2049: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2050: RAISE OKC_API.G_EXCEPTION_ERROR;
2051: END IF;
2044: p_init_msg_list,
2045: '_PVT',
2046: x_return_status);
2047: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2048: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2049: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2050: RAISE OKC_API.G_EXCEPTION_ERROR;
2051: END IF;
2052: BEGIN
2045: '_PVT',
2046: x_return_status);
2047: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2048: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2049: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2050: RAISE OKC_API.G_EXCEPTION_ERROR;
2051: END IF;
2052: BEGIN
2053: OPEN lock_csr(p_okc_k_history_tl_rec);
2046: x_return_status);
2047: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2048: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2049: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2050: RAISE OKC_API.G_EXCEPTION_ERROR;
2051: END IF;
2052: BEGIN
2053: OPEN lock_csr(p_okc_k_history_tl_rec);
2054: FETCH lock_csr INTO l_lock_var;
2058: WHEN E_Resource_Busy THEN
2059: IF (lock_csr%ISOPEN) THEN
2060: CLOSE lock_csr;
2061: END IF;
2062: OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2063: RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2064: END;
2065:
2066: IF ( l_row_notfound ) THEN
2063: RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2064: END;
2065:
2066: IF ( l_row_notfound ) THEN
2067: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2068: RAISE OKC_API.G_EXCEPTION_ERROR;
2069: END IF;
2070: x_return_status := l_return_status;
2071: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2064: END;
2065:
2066: IF ( l_row_notfound ) THEN
2067: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2068: RAISE OKC_API.G_EXCEPTION_ERROR;
2069: END IF;
2070: x_return_status := l_return_status;
2071: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2072: EXCEPTION
2067: OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2068: RAISE OKC_API.G_EXCEPTION_ERROR;
2069: END IF;
2070: x_return_status := l_return_status;
2071: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2072: EXCEPTION
2073: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2074: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2075: (
2069: END IF;
2070: x_return_status := l_return_status;
2071: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2072: EXCEPTION
2073: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2074: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2075: (
2076: l_api_name,
2077: G_PKG_NAME,
2070: x_return_status := l_return_status;
2071: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2072: EXCEPTION
2073: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2074: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2075: (
2076: l_api_name,
2077: G_PKG_NAME,
2078: 'OKC_API.G_RET_STS_ERROR',
2074: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2075: (
2076: l_api_name,
2077: G_PKG_NAME,
2078: 'OKC_API.G_RET_STS_ERROR',
2079: x_msg_count,
2080: x_msg_data,
2081: '_PVT'
2082: );
2079: x_msg_count,
2080: x_msg_data,
2081: '_PVT'
2082: );
2083: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2084: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2085: (
2086: l_api_name,
2087: G_PKG_NAME,
2080: x_msg_data,
2081: '_PVT'
2082: );
2083: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_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_UNEXP_ERROR',
2084: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2085: (
2086: l_api_name,
2087: G_PKG_NAME,
2088: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2089: x_msg_count,
2090: x_msg_data,
2091: '_PVT'
2092: );
2090: x_msg_data,
2091: '_PVT'
2092: );
2093: WHEN OTHERS THEN
2094: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2095: (
2096: l_api_name,
2097: G_PKG_NAME,
2098: 'OTHERS',
2113: p_hstv_rec IN hstv_rec_type) IS
2114:
2115: l_api_version CONSTANT NUMBER := 1;
2116: l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
2117: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2118: l_hst_rec hst_rec_type;
2119: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
2120: BEGIN
2121: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2117: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2118: l_hst_rec hst_rec_type;
2119: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
2120: BEGIN
2121: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2122: G_PKG_NAME,
2123: p_init_msg_list,
2124: l_api_version,
2125: p_api_version,
2124: l_api_version,
2125: p_api_version,
2126: '_PVT',
2127: x_return_status);
2128: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2129: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2130: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2131: RAISE OKC_API.G_EXCEPTION_ERROR;
2132: END IF;
2125: p_api_version,
2126: '_PVT',
2127: x_return_status);
2128: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2129: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2130: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2131: RAISE OKC_API.G_EXCEPTION_ERROR;
2132: END IF;
2133: -----------------------------------------
2126: '_PVT',
2127: x_return_status);
2128: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2129: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2130: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2131: RAISE OKC_API.G_EXCEPTION_ERROR;
2132: END IF;
2133: -----------------------------------------
2134: -- Move VIEW record to "Child" records --
2127: x_return_status);
2128: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2129: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2130: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2131: RAISE OKC_API.G_EXCEPTION_ERROR;
2132: END IF;
2133: -----------------------------------------
2134: -- Move VIEW record to "Child" records --
2135: -----------------------------------------
2144: x_msg_count,
2145: x_msg_data,
2146: l_hst_rec
2147: );
2148: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2149: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2150: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2151: RAISE OKC_API.G_EXCEPTION_ERROR;
2152: END IF;
2145: x_msg_data,
2146: l_hst_rec
2147: );
2148: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2149: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2150: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2151: RAISE OKC_API.G_EXCEPTION_ERROR;
2152: END IF;
2153: lock_row(
2146: l_hst_rec
2147: );
2148: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2149: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2150: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2151: RAISE OKC_API.G_EXCEPTION_ERROR;
2152: END IF;
2153: lock_row(
2154: p_init_msg_list,
2147: );
2148: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2149: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2150: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2151: RAISE OKC_API.G_EXCEPTION_ERROR;
2152: END IF;
2153: lock_row(
2154: p_init_msg_list,
2155: l_return_status,
2156: x_msg_count,
2157: x_msg_data,
2158: l_okc_k_history_tl_rec
2159: );
2160: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2161: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2162: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2163: RAISE OKC_API.G_EXCEPTION_ERROR;
2164: END IF;
2157: x_msg_data,
2158: l_okc_k_history_tl_rec
2159: );
2160: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2161: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2162: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2163: RAISE OKC_API.G_EXCEPTION_ERROR;
2164: END IF;
2165: x_return_status := l_return_status;
2158: l_okc_k_history_tl_rec
2159: );
2160: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2161: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2162: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2163: RAISE OKC_API.G_EXCEPTION_ERROR;
2164: END IF;
2165: x_return_status := l_return_status;
2166: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2159: );
2160: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2161: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2162: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2163: RAISE OKC_API.G_EXCEPTION_ERROR;
2164: END IF;
2165: x_return_status := l_return_status;
2166: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2167: EXCEPTION
2162: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2163: RAISE OKC_API.G_EXCEPTION_ERROR;
2164: END IF;
2165: x_return_status := l_return_status;
2166: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2167: EXCEPTION
2168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2169: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2170: (
2164: END IF;
2165: x_return_status := l_return_status;
2166: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2167: EXCEPTION
2168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2169: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2170: (
2171: l_api_name,
2172: G_PKG_NAME,
2165: x_return_status := l_return_status;
2166: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2167: EXCEPTION
2168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2169: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2170: (
2171: l_api_name,
2172: G_PKG_NAME,
2173: 'OKC_API.G_RET_STS_ERROR',
2169: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2170: (
2171: l_api_name,
2172: G_PKG_NAME,
2173: 'OKC_API.G_RET_STS_ERROR',
2174: x_msg_count,
2175: x_msg_data,
2176: '_PVT'
2177: );
2174: x_msg_count,
2175: x_msg_data,
2176: '_PVT'
2177: );
2178: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2179: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2180: (
2181: l_api_name,
2182: G_PKG_NAME,
2175: x_msg_data,
2176: '_PVT'
2177: );
2178: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2179: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2180: (
2181: l_api_name,
2182: G_PKG_NAME,
2183: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2179: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2180: (
2181: l_api_name,
2182: G_PKG_NAME,
2183: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2184: x_msg_count,
2185: x_msg_data,
2186: '_PVT'
2187: );
2185: x_msg_data,
2186: '_PVT'
2187: );
2188: WHEN OTHERS THEN
2189: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2190: (
2191: l_api_name,
2192: G_PKG_NAME,
2193: 'OTHERS',
2205: x_return_status OUT NOCOPY VARCHAR2,
2206: x_msg_count OUT NOCOPY NUMBER,
2207: x_msg_data OUT NOCOPY VARCHAR2,
2208: p_hstv_tbl IN hstv_tbl_type,
2209: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
2210:
2211: l_api_version CONSTANT NUMBER := 1;
2212: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_lock_row';
2213: i NUMBER := 0;
2211: l_api_version CONSTANT NUMBER := 1;
2212: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_lock_row';
2213: i NUMBER := 0;
2214: BEGIN
2215: OKC_API.init_msg_list(p_init_msg_list);
2216: -- Make sure PL/SQL table has recrods in it before passing
2217: IF (p_hstv_tbl.COUNT > 0) THEN
2218: i := p_hstv_tbl.FIRST;
2219: LOOP
2217: IF (p_hstv_tbl.COUNT > 0) THEN
2218: i := p_hstv_tbl.FIRST;
2219: LOOP
2220: DECLARE
2221: l_error_rec OKC_API.ERROR_REC_TYPE;
2222: BEGIN
2223: l_error_rec.api_name := l_api_name;
2224: l_error_rec.api_package := G_PKG_NAME;
2225: l_error_rec.idx := i;
2224: l_error_rec.api_package := G_PKG_NAME;
2225: l_error_rec.idx := i;
2226: lock_row(
2227: p_api_version => p_api_version,
2228: p_init_msg_list => OKC_API.G_FALSE,
2229: x_return_status => l_error_rec.error_type,
2230: x_msg_count => l_error_rec.msg_count,
2231: x_msg_data => l_error_rec.msg_data,
2232: p_hstv_rec => p_hstv_tbl(i));
2229: x_return_status => l_error_rec.error_type,
2230: x_msg_count => l_error_rec.msg_count,
2231: x_msg_data => l_error_rec.msg_data,
2232: p_hstv_rec => p_hstv_tbl(i));
2233: IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
2234: l_error_rec.sqlcode := SQLCODE;
2235: load_error_tbl(l_error_rec, px_error_tbl);
2236: ELSE
2237: x_msg_count := l_error_rec.msg_count;
2237: x_msg_count := l_error_rec.msg_count;
2238: x_msg_data := l_error_rec.msg_data;
2239: END IF;
2240: EXCEPTION
2241: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2242: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2243: l_error_rec.sqlcode := SQLCODE;
2244: load_error_tbl(l_error_rec, px_error_tbl);
2245: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2238: x_msg_data := l_error_rec.msg_data;
2239: END IF;
2240: EXCEPTION
2241: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2242: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2243: l_error_rec.sqlcode := SQLCODE;
2244: load_error_tbl(l_error_rec, px_error_tbl);
2245: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2246: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2241: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2242: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2243: l_error_rec.sqlcode := SQLCODE;
2244: load_error_tbl(l_error_rec, px_error_tbl);
2245: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2246: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2247: l_error_rec.sqlcode := SQLCODE;
2248: load_error_tbl(l_error_rec, px_error_tbl);
2249: WHEN OTHERS THEN
2242: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2243: l_error_rec.sqlcode := SQLCODE;
2244: load_error_tbl(l_error_rec, px_error_tbl);
2245: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2246: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2247: l_error_rec.sqlcode := SQLCODE;
2248: load_error_tbl(l_error_rec, px_error_tbl);
2249: WHEN OTHERS THEN
2250: l_error_rec.error_type := 'OTHERS';
2257: END IF;
2258: -- Loop through the error_tbl to find the error with the highest severity
2259: -- and return it.
2260: x_return_status := find_highest_exception(px_error_tbl);
2261: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2262: EXCEPTION
2263: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2264: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2265: (
2259: -- and return it.
2260: x_return_status := find_highest_exception(px_error_tbl);
2261: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2262: EXCEPTION
2263: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2264: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2265: (
2266: l_api_name,
2267: G_PKG_NAME,
2260: x_return_status := find_highest_exception(px_error_tbl);
2261: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2262: EXCEPTION
2263: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2264: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2265: (
2266: l_api_name,
2267: G_PKG_NAME,
2268: 'OKC_API.G_RET_STS_ERROR',
2264: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2265: (
2266: l_api_name,
2267: G_PKG_NAME,
2268: 'OKC_API.G_RET_STS_ERROR',
2269: x_msg_count,
2270: x_msg_data,
2271: '_PVT'
2272: );
2269: x_msg_count,
2270: x_msg_data,
2271: '_PVT'
2272: );
2273: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2274: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2275: (
2276: l_api_name,
2277: G_PKG_NAME,
2270: x_msg_data,
2271: '_PVT'
2272: );
2273: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2274: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2275: (
2276: l_api_name,
2277: G_PKG_NAME,
2278: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2274: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2275: (
2276: l_api_name,
2277: G_PKG_NAME,
2278: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2279: x_msg_count,
2280: x_msg_data,
2281: '_PVT'
2282: );
2280: x_msg_data,
2281: '_PVT'
2282: );
2283: WHEN OTHERS THEN
2284: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2285: (
2286: l_api_name,
2287: G_PKG_NAME,
2288: 'OTHERS',
2303: p_hstv_tbl IN hstv_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_error_tbl OKC_API.ERROR_TBL_TYPE;
2309: BEGIN
2310: OKC_API.init_msg_list(p_init_msg_list);
2311: -- Make sure PL/SQL table has recrods in it before passing
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_error_tbl OKC_API.ERROR_TBL_TYPE;
2309: BEGIN
2310: OKC_API.init_msg_list(p_init_msg_list);
2311: -- Make sure PL/SQL table has recrods in it before passing
2312: IF (p_hstv_tbl.COUNT > 0) THEN
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_error_tbl OKC_API.ERROR_TBL_TYPE;
2309: BEGIN
2310: OKC_API.init_msg_list(p_init_msg_list);
2311: -- Make sure PL/SQL table has recrods in it before passing
2312: IF (p_hstv_tbl.COUNT > 0) THEN
2313: lock_row(
2314: p_api_version => p_api_version,
2311: -- Make sure PL/SQL table has recrods in it before passing
2312: IF (p_hstv_tbl.COUNT > 0) THEN
2313: lock_row(
2314: p_api_version => p_api_version,
2315: p_init_msg_list => OKC_API.G_FALSE,
2316: x_return_status => x_return_status,
2317: x_msg_count => x_msg_count,
2318: x_msg_data => x_msg_data,
2319: p_hstv_tbl => p_hstv_tbl,
2318: x_msg_data => x_msg_data,
2319: p_hstv_tbl => p_hstv_tbl,
2320: px_error_tbl => l_error_tbl);
2321: END IF;
2322: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2323: EXCEPTION
2324: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2325: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2326: (
2320: px_error_tbl => l_error_tbl);
2321: END IF;
2322: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2323: EXCEPTION
2324: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2325: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2326: (
2327: l_api_name,
2328: G_PKG_NAME,
2321: END IF;
2322: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2323: EXCEPTION
2324: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2325: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2326: (
2327: l_api_name,
2328: G_PKG_NAME,
2329: 'OKC_API.G_RET_STS_ERROR',
2325: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2326: (
2327: l_api_name,
2328: G_PKG_NAME,
2329: 'OKC_API.G_RET_STS_ERROR',
2330: x_msg_count,
2331: x_msg_data,
2332: '_PVT'
2333: );
2330: x_msg_count,
2331: x_msg_data,
2332: '_PVT'
2333: );
2334: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2335: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2336: (
2337: l_api_name,
2338: G_PKG_NAME,
2331: x_msg_data,
2332: '_PVT'
2333: );
2334: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2335: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2336: (
2337: l_api_name,
2338: G_PKG_NAME,
2339: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2335: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2336: (
2337: l_api_name,
2338: G_PKG_NAME,
2339: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2340: x_msg_count,
2341: x_msg_data,
2342: '_PVT'
2343: );
2341: x_msg_data,
2342: '_PVT'
2343: );
2344: WHEN OTHERS THEN
2345: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2346: (
2347: l_api_name,
2348: G_PKG_NAME,
2349: 'OTHERS',
2367: x_hst_rec OUT NOCOPY hst_rec_type) IS
2368:
2369: l_api_version CONSTANT NUMBER := 1;
2370: l_api_name CONSTANT VARCHAR2(30) := 'B_update_row';
2371: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2372: l_hst_rec hst_rec_type := p_hst_rec;
2373: l_def_hst_rec hst_rec_type;
2374: l_row_notfound BOOLEAN := TRUE;
2375: ----------------------------------
2380: x_hst_rec OUT NOCOPY hst_rec_type
2381: ) RETURN VARCHAR2 IS
2382: l_hst_rec hst_rec_type;
2383: l_row_notfound BOOLEAN := TRUE;
2384: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2385: BEGIN
2386: x_hst_rec := p_hst_rec;
2387: -- Get current database values
2388: l_hst_rec := get_rec(p_hst_rec, l_return_status);
2385: BEGIN
2386: x_hst_rec := p_hst_rec;
2387: -- Get current database values
2388: l_hst_rec := get_rec(p_hst_rec, l_return_status);
2389: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2390: IF (x_hst_rec.id = OKC_API.G_MISS_NUM)
2391: THEN
2392: x_hst_rec.id := l_hst_rec.id;
2393: END IF;
2386: x_hst_rec := p_hst_rec;
2387: -- Get current database values
2388: l_hst_rec := get_rec(p_hst_rec, l_return_status);
2389: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2390: IF (x_hst_rec.id = OKC_API.G_MISS_NUM)
2391: THEN
2392: x_hst_rec.id := l_hst_rec.id;
2393: END IF;
2394: IF (x_hst_rec.chr_id = OKC_API.G_MISS_NUM)
2390: IF (x_hst_rec.id = OKC_API.G_MISS_NUM)
2391: THEN
2392: x_hst_rec.id := l_hst_rec.id;
2393: END IF;
2394: IF (x_hst_rec.chr_id = OKC_API.G_MISS_NUM)
2395: THEN
2396: x_hst_rec.chr_id := l_hst_rec.chr_id;
2397: END IF;
2398: IF (x_hst_rec.cle_id = OKC_API.G_MISS_NUM)
2394: IF (x_hst_rec.chr_id = OKC_API.G_MISS_NUM)
2395: THEN
2396: x_hst_rec.chr_id := l_hst_rec.chr_id;
2397: END IF;
2398: IF (x_hst_rec.cle_id = OKC_API.G_MISS_NUM)
2399: THEN
2400: x_hst_rec.cle_id := l_hst_rec.cle_id;
2401: END IF;
2402: IF (x_hst_rec.contract_version = OKC_API.G_MISS_CHAR)
2398: IF (x_hst_rec.cle_id = OKC_API.G_MISS_NUM)
2399: THEN
2400: x_hst_rec.cle_id := l_hst_rec.cle_id;
2401: END IF;
2402: IF (x_hst_rec.contract_version = OKC_API.G_MISS_CHAR)
2403: THEN
2404: x_hst_rec.contract_version := l_hst_rec.contract_version;
2405: END IF;
2406: IF (x_hst_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2402: IF (x_hst_rec.contract_version = OKC_API.G_MISS_CHAR)
2403: THEN
2404: x_hst_rec.contract_version := l_hst_rec.contract_version;
2405: END IF;
2406: IF (x_hst_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2407: THEN
2408: x_hst_rec.sts_code_from := l_hst_rec.sts_code_from;
2409: END IF;
2410: IF (x_hst_rec.opn_code = OKC_API.G_MISS_CHAR)
2406: IF (x_hst_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2407: THEN
2408: x_hst_rec.sts_code_from := l_hst_rec.sts_code_from;
2409: END IF;
2410: IF (x_hst_rec.opn_code = OKC_API.G_MISS_CHAR)
2411: THEN
2412: x_hst_rec.opn_code := l_hst_rec.opn_code;
2413: END IF;
2414: IF (x_hst_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2410: IF (x_hst_rec.opn_code = OKC_API.G_MISS_CHAR)
2411: THEN
2412: x_hst_rec.opn_code := l_hst_rec.opn_code;
2413: END IF;
2414: IF (x_hst_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2415: THEN
2416: x_hst_rec.sts_code_to := l_hst_rec.sts_code_to;
2417: END IF;
2418: IF (x_hst_rec.reason_code = OKC_API.G_MISS_CHAR)
2414: IF (x_hst_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2415: THEN
2416: x_hst_rec.sts_code_to := l_hst_rec.sts_code_to;
2417: END IF;
2418: IF (x_hst_rec.reason_code = OKC_API.G_MISS_CHAR)
2419: THEN
2420: x_hst_rec.reason_code := l_hst_rec.reason_code;
2421: END IF;
2422: IF (x_hst_rec.trn_code = OKC_API.G_MISS_CHAR)
2418: IF (x_hst_rec.reason_code = OKC_API.G_MISS_CHAR)
2419: THEN
2420: x_hst_rec.reason_code := l_hst_rec.reason_code;
2421: END IF;
2422: IF (x_hst_rec.trn_code = OKC_API.G_MISS_CHAR)
2423: THEN
2424: x_hst_rec.trn_code := l_hst_rec.trn_code;
2425: END IF;
2426: IF (x_hst_rec.manual_yn = OKC_API.G_MISS_CHAR)
2422: IF (x_hst_rec.trn_code = OKC_API.G_MISS_CHAR)
2423: THEN
2424: x_hst_rec.trn_code := l_hst_rec.trn_code;
2425: END IF;
2426: IF (x_hst_rec.manual_yn = OKC_API.G_MISS_CHAR)
2427: THEN
2428: x_hst_rec.manual_yn := l_hst_rec.manual_yn;
2429: END IF;
2430: IF (x_hst_rec.created_by = OKC_API.G_MISS_NUM)
2426: IF (x_hst_rec.manual_yn = OKC_API.G_MISS_CHAR)
2427: THEN
2428: x_hst_rec.manual_yn := l_hst_rec.manual_yn;
2429: END IF;
2430: IF (x_hst_rec.created_by = OKC_API.G_MISS_NUM)
2431: THEN
2432: x_hst_rec.created_by := l_hst_rec.created_by;
2433: END IF;
2434: IF (x_hst_rec.creation_date = OKC_API.G_MISS_DATE)
2430: IF (x_hst_rec.created_by = OKC_API.G_MISS_NUM)
2431: THEN
2432: x_hst_rec.created_by := l_hst_rec.created_by;
2433: END IF;
2434: IF (x_hst_rec.creation_date = OKC_API.G_MISS_DATE)
2435: THEN
2436: x_hst_rec.creation_date := l_hst_rec.creation_date;
2437: END IF;
2438: IF (x_hst_rec.last_updated_by = OKC_API.G_MISS_NUM)
2434: IF (x_hst_rec.creation_date = OKC_API.G_MISS_DATE)
2435: THEN
2436: x_hst_rec.creation_date := l_hst_rec.creation_date;
2437: END IF;
2438: IF (x_hst_rec.last_updated_by = OKC_API.G_MISS_NUM)
2439: THEN
2440: x_hst_rec.last_updated_by := l_hst_rec.last_updated_by;
2441: END IF;
2442: IF (x_hst_rec.last_update_date = OKC_API.G_MISS_DATE)
2438: IF (x_hst_rec.last_updated_by = OKC_API.G_MISS_NUM)
2439: THEN
2440: x_hst_rec.last_updated_by := l_hst_rec.last_updated_by;
2441: END IF;
2442: IF (x_hst_rec.last_update_date = OKC_API.G_MISS_DATE)
2443: THEN
2444: x_hst_rec.last_update_date := l_hst_rec.last_update_date;
2445: END IF;
2446: IF (x_hst_rec.object_version_number = OKC_API.G_MISS_NUM)
2442: IF (x_hst_rec.last_update_date = OKC_API.G_MISS_DATE)
2443: THEN
2444: x_hst_rec.last_update_date := l_hst_rec.last_update_date;
2445: END IF;
2446: IF (x_hst_rec.object_version_number = OKC_API.G_MISS_NUM)
2447: THEN
2448: x_hst_rec.object_version_number := l_hst_rec.object_version_number;
2449: END IF;
2450: IF (x_hst_rec.last_update_login = OKC_API.G_MISS_NUM)
2446: IF (x_hst_rec.object_version_number = OKC_API.G_MISS_NUM)
2447: THEN
2448: x_hst_rec.object_version_number := l_hst_rec.object_version_number;
2449: END IF;
2450: IF (x_hst_rec.last_update_login = OKC_API.G_MISS_NUM)
2451: THEN
2452: x_hst_rec.last_update_login := l_hst_rec.last_update_login;
2453: END IF;
2454: IF (x_hst_rec.program_application_id = OKC_API.G_MISS_NUM)
2450: IF (x_hst_rec.last_update_login = OKC_API.G_MISS_NUM)
2451: THEN
2452: x_hst_rec.last_update_login := l_hst_rec.last_update_login;
2453: END IF;
2454: IF (x_hst_rec.program_application_id = OKC_API.G_MISS_NUM)
2455: THEN
2456: x_hst_rec.program_application_id := l_hst_rec.program_application_id;
2457: END IF;
2458: IF (x_hst_rec.program_id = OKC_API.G_MISS_NUM)
2454: IF (x_hst_rec.program_application_id = OKC_API.G_MISS_NUM)
2455: THEN
2456: x_hst_rec.program_application_id := l_hst_rec.program_application_id;
2457: END IF;
2458: IF (x_hst_rec.program_id = OKC_API.G_MISS_NUM)
2459: THEN
2460: x_hst_rec.program_id := l_hst_rec.program_id;
2461: END IF;
2462: IF (x_hst_rec.program_update_date = OKC_API.G_MISS_DATE)
2458: IF (x_hst_rec.program_id = OKC_API.G_MISS_NUM)
2459: THEN
2460: x_hst_rec.program_id := l_hst_rec.program_id;
2461: END IF;
2462: IF (x_hst_rec.program_update_date = OKC_API.G_MISS_DATE)
2463: THEN
2464: x_hst_rec.program_update_date := l_hst_rec.program_update_date;
2465: END IF;
2466: IF (x_hst_rec.request_id = OKC_API.G_MISS_NUM)
2462: IF (x_hst_rec.program_update_date = OKC_API.G_MISS_DATE)
2463: THEN
2464: x_hst_rec.program_update_date := l_hst_rec.program_update_date;
2465: END IF;
2466: IF (x_hst_rec.request_id = OKC_API.G_MISS_NUM)
2467: THEN
2468: x_hst_rec.request_id := l_hst_rec.request_id;
2469: END IF;
2470: END IF;
2476: FUNCTION Set_Attributes (
2477: p_hst_rec IN hst_rec_type,
2478: x_hst_rec OUT NOCOPY hst_rec_type
2479: ) RETURN VARCHAR2 IS
2480: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2481: BEGIN
2482: x_hst_rec := p_hst_rec;
2483: x_hst_rec.OBJECT_VERSION_NUMBER := p_hst_rec.OBJECT_VERSION_NUMBER + 1;
2484: RETURN(l_return_status);
2483: x_hst_rec.OBJECT_VERSION_NUMBER := p_hst_rec.OBJECT_VERSION_NUMBER + 1;
2484: RETURN(l_return_status);
2485: END Set_Attributes;
2486: BEGIN
2487: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2488: p_init_msg_list,
2489: '_PVT',
2490: x_return_status);
2491: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2487: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2488: p_init_msg_list,
2489: '_PVT',
2490: x_return_status);
2491: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2492: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2493: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2494: RAISE OKC_API.G_EXCEPTION_ERROR;
2495: END IF;
2488: p_init_msg_list,
2489: '_PVT',
2490: x_return_status);
2491: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2492: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2493: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2494: RAISE OKC_API.G_EXCEPTION_ERROR;
2495: END IF;
2496: --- Setting item attributes
2489: '_PVT',
2490: x_return_status);
2491: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2492: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2493: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2494: RAISE OKC_API.G_EXCEPTION_ERROR;
2495: END IF;
2496: --- Setting item attributes
2497: l_return_status := Set_Attributes(
2490: x_return_status);
2491: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2492: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2493: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2494: RAISE OKC_API.G_EXCEPTION_ERROR;
2495: END IF;
2496: --- Setting item attributes
2497: l_return_status := Set_Attributes(
2498: p_hst_rec, -- IN
2497: l_return_status := Set_Attributes(
2498: p_hst_rec, -- IN
2499: l_hst_rec); -- OUT
2500: --- If any errors happen abort API
2501: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2502: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2503: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2498: p_hst_rec, -- IN
2499: l_hst_rec); -- OUT
2500: --- If any errors happen abort API
2501: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2502: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2503: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2499: l_hst_rec); -- OUT
2500: --- If any errors happen abort API
2501: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2502: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2503: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2500: --- If any errors happen abort API
2501: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2502: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2503: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2503: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2509: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2510: RAISE OKC_API.G_EXCEPTION_ERROR;
2511: END IF;
2504: RAISE OKC_API.G_EXCEPTION_ERROR;
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2509: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2510: RAISE OKC_API.G_EXCEPTION_ERROR;
2511: END IF;
2512: UPDATE OKC_K_HISTORY_B
2505: END IF;
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2509: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2510: RAISE OKC_API.G_EXCEPTION_ERROR;
2511: END IF;
2512: UPDATE OKC_K_HISTORY_B
2513: SET CHR_ID = l_def_hst_rec.chr_id,
2506: l_return_status := populate_new_record(l_hst_rec, l_def_hst_rec);
2507: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2509: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2510: RAISE OKC_API.G_EXCEPTION_ERROR;
2511: END IF;
2512: UPDATE OKC_K_HISTORY_B
2513: SET CHR_ID = l_def_hst_rec.chr_id,
2514: CLE_ID = l_def_hst_rec.cle_id,
2532: WHERE ID = l_def_hst_rec.id;
2533:
2534: x_hst_rec := l_hst_rec;
2535: x_return_status := l_return_status;
2536: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2537: EXCEPTION
2538: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2539: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2540: (
2534: x_hst_rec := l_hst_rec;
2535: x_return_status := l_return_status;
2536: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2537: EXCEPTION
2538: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2539: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2540: (
2541: l_api_name,
2542: G_PKG_NAME,
2535: x_return_status := l_return_status;
2536: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2537: EXCEPTION
2538: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2539: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2540: (
2541: l_api_name,
2542: G_PKG_NAME,
2543: 'OKC_API.G_RET_STS_ERROR',
2539: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2540: (
2541: l_api_name,
2542: G_PKG_NAME,
2543: 'OKC_API.G_RET_STS_ERROR',
2544: x_msg_count,
2545: x_msg_data,
2546: '_PVT'
2547: );
2544: x_msg_count,
2545: x_msg_data,
2546: '_PVT'
2547: );
2548: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2549: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2550: (
2551: l_api_name,
2552: G_PKG_NAME,
2545: x_msg_data,
2546: '_PVT'
2547: );
2548: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2549: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2550: (
2551: l_api_name,
2552: G_PKG_NAME,
2553: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2549: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2550: (
2551: l_api_name,
2552: G_PKG_NAME,
2553: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2554: x_msg_count,
2555: x_msg_data,
2556: '_PVT'
2557: );
2555: x_msg_data,
2556: '_PVT'
2557: );
2558: WHEN OTHERS THEN
2559: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2560: (
2561: l_api_name,
2562: G_PKG_NAME,
2563: 'OTHERS',
2578: x_okc_k_history_tl_rec OUT NOCOPY okc_k_history_tl_rec_type) IS
2579:
2580: l_api_version CONSTANT NUMBER := 1;
2581: l_api_name CONSTANT VARCHAR2(30) := 'TL_update_row';
2582: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2583: l_okc_k_history_tl_rec okc_k_history_tl_rec_type := p_okc_k_history_tl_rec;
2584: l_def_okc_k_history_tl_rec okc_k_history_tl_rec_type;
2585: l_row_notfound BOOLEAN := TRUE;
2586: ----------------------------------
2591: x_okc_k_history_tl_rec OUT NOCOPY okc_k_history_tl_rec_type
2592: ) RETURN VARCHAR2 IS
2593: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
2594: l_row_notfound BOOLEAN := TRUE;
2595: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2596: BEGIN
2597: x_okc_k_history_tl_rec := p_okc_k_history_tl_rec;
2598: -- Get current database values
2599: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_return_status);
2596: BEGIN
2597: x_okc_k_history_tl_rec := p_okc_k_history_tl_rec;
2598: -- Get current database values
2599: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_return_status);
2600: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2601: IF (x_okc_k_history_tl_rec.id = OKC_API.G_MISS_NUM)
2602: THEN
2603: x_okc_k_history_tl_rec.id := l_okc_k_history_tl_rec.id;
2604: END IF;
2597: x_okc_k_history_tl_rec := p_okc_k_history_tl_rec;
2598: -- Get current database values
2599: l_okc_k_history_tl_rec := get_rec(p_okc_k_history_tl_rec, l_return_status);
2600: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2601: IF (x_okc_k_history_tl_rec.id = OKC_API.G_MISS_NUM)
2602: THEN
2603: x_okc_k_history_tl_rec.id := l_okc_k_history_tl_rec.id;
2604: END IF;
2605: IF (x_okc_k_history_tl_rec.language = OKC_API.G_MISS_CHAR)
2601: IF (x_okc_k_history_tl_rec.id = OKC_API.G_MISS_NUM)
2602: THEN
2603: x_okc_k_history_tl_rec.id := l_okc_k_history_tl_rec.id;
2604: END IF;
2605: IF (x_okc_k_history_tl_rec.language = OKC_API.G_MISS_CHAR)
2606: THEN
2607: x_okc_k_history_tl_rec.language := l_okc_k_history_tl_rec.language;
2608: END IF;
2609: IF (x_okc_k_history_tl_rec.source_lang = OKC_API.G_MISS_CHAR)
2605: IF (x_okc_k_history_tl_rec.language = OKC_API.G_MISS_CHAR)
2606: THEN
2607: x_okc_k_history_tl_rec.language := l_okc_k_history_tl_rec.language;
2608: END IF;
2609: IF (x_okc_k_history_tl_rec.source_lang = OKC_API.G_MISS_CHAR)
2610: THEN
2611: x_okc_k_history_tl_rec.source_lang := l_okc_k_history_tl_rec.source_lang;
2612: END IF;
2613: IF (x_okc_k_history_tl_rec.comments = OKC_API.G_MISS_CHAR)
2609: IF (x_okc_k_history_tl_rec.source_lang = OKC_API.G_MISS_CHAR)
2610: THEN
2611: x_okc_k_history_tl_rec.source_lang := l_okc_k_history_tl_rec.source_lang;
2612: END IF;
2613: IF (x_okc_k_history_tl_rec.comments = OKC_API.G_MISS_CHAR)
2614: THEN
2615: x_okc_k_history_tl_rec.comments := l_okc_k_history_tl_rec.comments;
2616: END IF;
2617: IF (x_okc_k_history_tl_rec.created_by = OKC_API.G_MISS_NUM)
2613: IF (x_okc_k_history_tl_rec.comments = OKC_API.G_MISS_CHAR)
2614: THEN
2615: x_okc_k_history_tl_rec.comments := l_okc_k_history_tl_rec.comments;
2616: END IF;
2617: IF (x_okc_k_history_tl_rec.created_by = OKC_API.G_MISS_NUM)
2618: THEN
2619: x_okc_k_history_tl_rec.created_by := l_okc_k_history_tl_rec.created_by;
2620: END IF;
2621: IF (x_okc_k_history_tl_rec.creation_date = OKC_API.G_MISS_DATE)
2617: IF (x_okc_k_history_tl_rec.created_by = OKC_API.G_MISS_NUM)
2618: THEN
2619: x_okc_k_history_tl_rec.created_by := l_okc_k_history_tl_rec.created_by;
2620: END IF;
2621: IF (x_okc_k_history_tl_rec.creation_date = OKC_API.G_MISS_DATE)
2622: THEN
2623: x_okc_k_history_tl_rec.creation_date := l_okc_k_history_tl_rec.creation_date;
2624: END IF;
2625: IF (x_okc_k_history_tl_rec.last_updated_by = OKC_API.G_MISS_NUM)
2621: IF (x_okc_k_history_tl_rec.creation_date = OKC_API.G_MISS_DATE)
2622: THEN
2623: x_okc_k_history_tl_rec.creation_date := l_okc_k_history_tl_rec.creation_date;
2624: END IF;
2625: IF (x_okc_k_history_tl_rec.last_updated_by = OKC_API.G_MISS_NUM)
2626: THEN
2627: x_okc_k_history_tl_rec.last_updated_by := l_okc_k_history_tl_rec.last_updated_by;
2628: END IF;
2629: IF (x_okc_k_history_tl_rec.last_update_date = OKC_API.G_MISS_DATE)
2625: IF (x_okc_k_history_tl_rec.last_updated_by = OKC_API.G_MISS_NUM)
2626: THEN
2627: x_okc_k_history_tl_rec.last_updated_by := l_okc_k_history_tl_rec.last_updated_by;
2628: END IF;
2629: IF (x_okc_k_history_tl_rec.last_update_date = OKC_API.G_MISS_DATE)
2630: THEN
2631: x_okc_k_history_tl_rec.last_update_date := l_okc_k_history_tl_rec.last_update_date;
2632: END IF;
2633: IF (x_okc_k_history_tl_rec.last_update_login = OKC_API.G_MISS_NUM)
2629: IF (x_okc_k_history_tl_rec.last_update_date = OKC_API.G_MISS_DATE)
2630: THEN
2631: x_okc_k_history_tl_rec.last_update_date := l_okc_k_history_tl_rec.last_update_date;
2632: END IF;
2633: IF (x_okc_k_history_tl_rec.last_update_login = OKC_API.G_MISS_NUM)
2634: THEN
2635: x_okc_k_history_tl_rec.last_update_login := l_okc_k_history_tl_rec.last_update_login;
2636: END IF;
2637: END IF;
2643: FUNCTION Set_Attributes (
2644: p_okc_k_history_tl_rec IN okc_k_history_tl_rec_type,
2645: x_okc_k_history_tl_rec OUT NOCOPY okc_k_history_tl_rec_type
2646: ) RETURN VARCHAR2 IS
2647: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2648: BEGIN
2649: x_okc_k_history_tl_rec := p_okc_k_history_tl_rec;
2650: x_okc_k_history_tl_rec.LANGUAGE := USERENV('LANG');
2651: x_okc_k_history_tl_rec.LANGUAGE := USERENV('LANG');
2651: x_okc_k_history_tl_rec.LANGUAGE := USERENV('LANG');
2652: RETURN(l_return_status);
2653: END Set_Attributes;
2654: BEGIN
2655: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2656: p_init_msg_list,
2657: '_PVT',
2658: x_return_status);
2659: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2655: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2656: p_init_msg_list,
2657: '_PVT',
2658: x_return_status);
2659: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2660: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2661: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2662: RAISE OKC_API.G_EXCEPTION_ERROR;
2663: END IF;
2656: p_init_msg_list,
2657: '_PVT',
2658: x_return_status);
2659: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2660: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2661: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2662: RAISE OKC_API.G_EXCEPTION_ERROR;
2663: END IF;
2664: --- Setting item attributes
2657: '_PVT',
2658: x_return_status);
2659: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2660: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2661: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2662: RAISE OKC_API.G_EXCEPTION_ERROR;
2663: END IF;
2664: --- Setting item attributes
2665: l_return_status := Set_Attributes(
2658: x_return_status);
2659: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2660: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2661: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2662: RAISE OKC_API.G_EXCEPTION_ERROR;
2663: END IF;
2664: --- Setting item attributes
2665: l_return_status := Set_Attributes(
2666: p_okc_k_history_tl_rec, -- IN
2665: l_return_status := Set_Attributes(
2666: p_okc_k_history_tl_rec, -- IN
2667: l_okc_k_history_tl_rec); -- OUT
2668: --- If any errors happen abort API
2669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2666: p_okc_k_history_tl_rec, -- IN
2667: l_okc_k_history_tl_rec); -- OUT
2668: --- If any errors happen abort API
2669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2667: l_okc_k_history_tl_rec); -- OUT
2668: --- If any errors happen abort API
2669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2668: --- If any errors happen abort API
2669: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2670: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2671: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2677: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2678: RAISE OKC_API.G_EXCEPTION_ERROR;
2679: END IF;
2672: RAISE OKC_API.G_EXCEPTION_ERROR;
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2677: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2678: RAISE OKC_API.G_EXCEPTION_ERROR;
2679: END IF;
2680: UPDATE OKC_K_HISTORY_TL
2673: END IF;
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2677: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2678: RAISE OKC_API.G_EXCEPTION_ERROR;
2679: END IF;
2680: UPDATE OKC_K_HISTORY_TL
2681: SET COMMENTS = l_def_okc_k_history_tl_rec.comments,
2674: l_return_status := populate_new_record(l_okc_k_history_tl_rec, l_def_okc_k_history_tl_rec);
2675: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2677: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2678: RAISE OKC_API.G_EXCEPTION_ERROR;
2679: END IF;
2680: UPDATE OKC_K_HISTORY_TL
2681: SET COMMENTS = l_def_okc_k_history_tl_rec.comments,
2682: CREATED_BY = l_def_okc_k_history_tl_rec.created_by,
2695: -- AND SOURCE_LANG <> USERENV('LANG');
2696:
2697: x_okc_k_history_tl_rec := l_okc_k_history_tl_rec;
2698: x_return_status := l_return_status;
2699: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2700: EXCEPTION
2701: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2702: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2703: (
2697: x_okc_k_history_tl_rec := l_okc_k_history_tl_rec;
2698: x_return_status := l_return_status;
2699: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2700: EXCEPTION
2701: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2702: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2703: (
2704: l_api_name,
2705: G_PKG_NAME,
2698: x_return_status := l_return_status;
2699: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2700: EXCEPTION
2701: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2702: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2703: (
2704: l_api_name,
2705: G_PKG_NAME,
2706: 'OKC_API.G_RET_STS_ERROR',
2702: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2703: (
2704: l_api_name,
2705: G_PKG_NAME,
2706: 'OKC_API.G_RET_STS_ERROR',
2707: x_msg_count,
2708: x_msg_data,
2709: '_PVT'
2710: );
2707: x_msg_count,
2708: x_msg_data,
2709: '_PVT'
2710: );
2711: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2712: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2713: (
2714: l_api_name,
2715: G_PKG_NAME,
2708: x_msg_data,
2709: '_PVT'
2710: );
2711: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2712: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2713: (
2714: l_api_name,
2715: G_PKG_NAME,
2716: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2712: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2713: (
2714: l_api_name,
2715: G_PKG_NAME,
2716: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2717: x_msg_count,
2718: x_msg_data,
2719: '_PVT'
2720: );
2718: x_msg_data,
2719: '_PVT'
2720: );
2721: WHEN OTHERS THEN
2722: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2723: (
2724: l_api_name,
2725: G_PKG_NAME,
2726: 'OTHERS',
2742: x_hstv_rec OUT NOCOPY hstv_rec_type) IS
2743:
2744: l_api_version CONSTANT NUMBER := 1;
2745: l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
2746: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2747: l_hstv_rec hstv_rec_type := p_hstv_rec;
2748: l_def_hstv_rec hstv_rec_type;
2749: l_db_hstv_rec hstv_rec_type;
2750: l_hst_rec hst_rec_type;
2771: p_hstv_rec IN hstv_rec_type,
2772: x_hstv_rec OUT NOCOPY hstv_rec_type
2773: ) RETURN VARCHAR2 IS
2774: l_row_notfound BOOLEAN := TRUE;
2775: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2776: BEGIN
2777: x_hstv_rec := p_hstv_rec;
2778: -- Get current database values
2779: -- NOTE: Never assign the OBJECT_VERSION_NUMBER. Force the user to pass it
2778: -- Get current database values
2779: -- NOTE: Never assign the OBJECT_VERSION_NUMBER. Force the user to pass it
2780: -- so it may be verified through LOCK_ROW.
2781: l_db_hstv_rec := get_rec(p_hstv_rec, l_return_status);
2782: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2783: IF (x_hstv_rec.id = OKC_API.G_MISS_NUM)
2784: THEN
2785: x_hstv_rec.id := l_db_hstv_rec.id;
2786: END IF;
2779: -- NOTE: Never assign the OBJECT_VERSION_NUMBER. Force the user to pass it
2780: -- so it may be verified through LOCK_ROW.
2781: l_db_hstv_rec := get_rec(p_hstv_rec, l_return_status);
2782: IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2783: IF (x_hstv_rec.id = OKC_API.G_MISS_NUM)
2784: THEN
2785: x_hstv_rec.id := l_db_hstv_rec.id;
2786: END IF;
2787: IF (x_hstv_rec.chr_id = OKC_API.G_MISS_NUM)
2783: IF (x_hstv_rec.id = OKC_API.G_MISS_NUM)
2784: THEN
2785: x_hstv_rec.id := l_db_hstv_rec.id;
2786: END IF;
2787: IF (x_hstv_rec.chr_id = OKC_API.G_MISS_NUM)
2788: THEN
2789: x_hstv_rec.chr_id := l_db_hstv_rec.chr_id;
2790: END IF;
2791: IF (x_hstv_rec.cle_id = OKC_API.G_MISS_NUM)
2787: IF (x_hstv_rec.chr_id = OKC_API.G_MISS_NUM)
2788: THEN
2789: x_hstv_rec.chr_id := l_db_hstv_rec.chr_id;
2790: END IF;
2791: IF (x_hstv_rec.cle_id = OKC_API.G_MISS_NUM)
2792: THEN
2793: x_hstv_rec.cle_id := l_db_hstv_rec.cle_id;
2794: END IF;
2795: IF (x_hstv_rec.contract_version = OKC_API.G_MISS_CHAR)
2791: IF (x_hstv_rec.cle_id = OKC_API.G_MISS_NUM)
2792: THEN
2793: x_hstv_rec.cle_id := l_db_hstv_rec.cle_id;
2794: END IF;
2795: IF (x_hstv_rec.contract_version = OKC_API.G_MISS_CHAR)
2796: THEN
2797: x_hstv_rec.contract_version := l_db_hstv_rec.contract_version;
2798: END IF;
2799: IF (x_hstv_rec.opn_code = OKC_API.G_MISS_CHAR)
2795: IF (x_hstv_rec.contract_version = OKC_API.G_MISS_CHAR)
2796: THEN
2797: x_hstv_rec.contract_version := l_db_hstv_rec.contract_version;
2798: END IF;
2799: IF (x_hstv_rec.opn_code = OKC_API.G_MISS_CHAR)
2800: THEN
2801: x_hstv_rec.opn_code := l_db_hstv_rec.opn_code;
2802: END IF;
2803: IF (x_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2799: IF (x_hstv_rec.opn_code = OKC_API.G_MISS_CHAR)
2800: THEN
2801: x_hstv_rec.opn_code := l_db_hstv_rec.opn_code;
2802: END IF;
2803: IF (x_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2804: THEN
2805: x_hstv_rec.sts_code_from := l_db_hstv_rec.sts_code_from;
2806: END IF;
2807: IF (x_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2803: IF (x_hstv_rec.sts_code_from = OKC_API.G_MISS_CHAR)
2804: THEN
2805: x_hstv_rec.sts_code_from := l_db_hstv_rec.sts_code_from;
2806: END IF;
2807: IF (x_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2808: THEN
2809: x_hstv_rec.sts_code_to := l_db_hstv_rec.sts_code_to;
2810: END IF;
2811: IF (x_hstv_rec.reason_code = OKC_API.G_MISS_CHAR)
2807: IF (x_hstv_rec.sts_code_to = OKC_API.G_MISS_CHAR)
2808: THEN
2809: x_hstv_rec.sts_code_to := l_db_hstv_rec.sts_code_to;
2810: END IF;
2811: IF (x_hstv_rec.reason_code = OKC_API.G_MISS_CHAR)
2812: THEN
2813: x_hstv_rec.reason_code := l_db_hstv_rec.reason_code;
2814: END IF;
2815: IF (x_hstv_rec.trn_code = OKC_API.G_MISS_CHAR)
2811: IF (x_hstv_rec.reason_code = OKC_API.G_MISS_CHAR)
2812: THEN
2813: x_hstv_rec.reason_code := l_db_hstv_rec.reason_code;
2814: END IF;
2815: IF (x_hstv_rec.trn_code = OKC_API.G_MISS_CHAR)
2816: THEN
2817: x_hstv_rec.trn_code := l_db_hstv_rec.trn_code;
2818: END IF;
2819: IF (x_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR)
2815: IF (x_hstv_rec.trn_code = OKC_API.G_MISS_CHAR)
2816: THEN
2817: x_hstv_rec.trn_code := l_db_hstv_rec.trn_code;
2818: END IF;
2819: IF (x_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR)
2820: THEN
2821: x_hstv_rec.manual_yn := l_db_hstv_rec.manual_yn;
2822: END IF;
2823: IF (x_hstv_rec.comments = OKC_API.G_MISS_CHAR)
2819: IF (x_hstv_rec.manual_yn = OKC_API.G_MISS_CHAR)
2820: THEN
2821: x_hstv_rec.manual_yn := l_db_hstv_rec.manual_yn;
2822: END IF;
2823: IF (x_hstv_rec.comments = OKC_API.G_MISS_CHAR)
2824: THEN
2825: x_hstv_rec.comments := l_db_hstv_rec.comments;
2826: END IF;
2827: IF (x_hstv_rec.created_by = OKC_API.G_MISS_NUM)
2823: IF (x_hstv_rec.comments = OKC_API.G_MISS_CHAR)
2824: THEN
2825: x_hstv_rec.comments := l_db_hstv_rec.comments;
2826: END IF;
2827: IF (x_hstv_rec.created_by = OKC_API.G_MISS_NUM)
2828: THEN
2829: x_hstv_rec.created_by := l_db_hstv_rec.created_by;
2830: END IF;
2831: IF (x_hstv_rec.creation_date = OKC_API.G_MISS_DATE)
2827: IF (x_hstv_rec.created_by = OKC_API.G_MISS_NUM)
2828: THEN
2829: x_hstv_rec.created_by := l_db_hstv_rec.created_by;
2830: END IF;
2831: IF (x_hstv_rec.creation_date = OKC_API.G_MISS_DATE)
2832: THEN
2833: x_hstv_rec.creation_date := l_db_hstv_rec.creation_date;
2834: END IF;
2835: IF (x_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM)
2831: IF (x_hstv_rec.creation_date = OKC_API.G_MISS_DATE)
2832: THEN
2833: x_hstv_rec.creation_date := l_db_hstv_rec.creation_date;
2834: END IF;
2835: IF (x_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM)
2836: THEN
2837: x_hstv_rec.last_updated_by := l_db_hstv_rec.last_updated_by;
2838: END IF;
2839: IF (x_hstv_rec.last_update_date = OKC_API.G_MISS_DATE)
2835: IF (x_hstv_rec.last_updated_by = OKC_API.G_MISS_NUM)
2836: THEN
2837: x_hstv_rec.last_updated_by := l_db_hstv_rec.last_updated_by;
2838: END IF;
2839: IF (x_hstv_rec.last_update_date = OKC_API.G_MISS_DATE)
2840: THEN
2841: x_hstv_rec.last_update_date := l_db_hstv_rec.last_update_date;
2842: END IF;
2843: IF (x_hstv_rec.last_update_login = OKC_API.G_MISS_NUM)
2839: IF (x_hstv_rec.last_update_date = OKC_API.G_MISS_DATE)
2840: THEN
2841: x_hstv_rec.last_update_date := l_db_hstv_rec.last_update_date;
2842: END IF;
2843: IF (x_hstv_rec.last_update_login = OKC_API.G_MISS_NUM)
2844: THEN
2845: x_hstv_rec.last_update_login := l_db_hstv_rec.last_update_login;
2846: END IF;
2847: IF (x_hstv_rec.program_application_id = OKC_API.G_MISS_NUM)
2843: IF (x_hstv_rec.last_update_login = OKC_API.G_MISS_NUM)
2844: THEN
2845: x_hstv_rec.last_update_login := l_db_hstv_rec.last_update_login;
2846: END IF;
2847: IF (x_hstv_rec.program_application_id = OKC_API.G_MISS_NUM)
2848: THEN
2849: x_hstv_rec.program_application_id := l_db_hstv_rec.program_application_id;
2850: END IF;
2851: IF (x_hstv_rec.program_id = OKC_API.G_MISS_NUM)
2847: IF (x_hstv_rec.program_application_id = OKC_API.G_MISS_NUM)
2848: THEN
2849: x_hstv_rec.program_application_id := l_db_hstv_rec.program_application_id;
2850: END IF;
2851: IF (x_hstv_rec.program_id = OKC_API.G_MISS_NUM)
2852: THEN
2853: x_hstv_rec.program_id := l_db_hstv_rec.program_id;
2854: END IF;
2855: IF (x_hstv_rec.program_update_date = OKC_API.G_MISS_DATE)
2851: IF (x_hstv_rec.program_id = OKC_API.G_MISS_NUM)
2852: THEN
2853: x_hstv_rec.program_id := l_db_hstv_rec.program_id;
2854: END IF;
2855: IF (x_hstv_rec.program_update_date = OKC_API.G_MISS_DATE)
2856: THEN
2857: x_hstv_rec.program_update_date := l_db_hstv_rec.program_update_date;
2858: END IF;
2859: IF (x_hstv_rec.request_id = OKC_API.G_MISS_NUM)
2855: IF (x_hstv_rec.program_update_date = OKC_API.G_MISS_DATE)
2856: THEN
2857: x_hstv_rec.program_update_date := l_db_hstv_rec.program_update_date;
2858: END IF;
2859: IF (x_hstv_rec.request_id = OKC_API.G_MISS_NUM)
2860: THEN
2861: x_hstv_rec.request_id := l_db_hstv_rec.request_id;
2862: END IF;
2863: END IF;
2869: FUNCTION Set_Attributes (
2870: p_hstv_rec IN hstv_rec_type,
2871: x_hstv_rec OUT NOCOPY hstv_rec_type
2872: ) RETURN VARCHAR2 IS
2873: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2874: BEGIN
2875: x_hstv_rec := p_hstv_rec;
2876: RETURN(l_return_status);
2877: END Set_Attributes;
2875: x_hstv_rec := p_hstv_rec;
2876: RETURN(l_return_status);
2877: END Set_Attributes;
2878: BEGIN
2879: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2880: G_PKG_NAME,
2881: p_init_msg_list,
2882: l_api_version,
2883: p_api_version,
2882: l_api_version,
2883: p_api_version,
2884: '_PVT',
2885: x_return_status);
2886: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2887: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2888: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2889: RAISE OKC_API.G_EXCEPTION_ERROR;
2890: END IF;
2883: p_api_version,
2884: '_PVT',
2885: x_return_status);
2886: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2887: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2888: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2889: RAISE OKC_API.G_EXCEPTION_ERROR;
2890: END IF;
2891: --- Setting item attributes
2884: '_PVT',
2885: x_return_status);
2886: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2887: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2888: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2889: RAISE OKC_API.G_EXCEPTION_ERROR;
2890: END IF;
2891: --- Setting item attributes
2892: l_return_status := Set_Attributes(
2885: x_return_status);
2886: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2887: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2888: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2889: RAISE OKC_API.G_EXCEPTION_ERROR;
2890: END IF;
2891: --- Setting item attributes
2892: l_return_status := Set_Attributes(
2893: p_hstv_rec, -- IN
2892: l_return_status := Set_Attributes(
2893: p_hstv_rec, -- IN
2894: x_hstv_rec); -- OUT
2895: --- If any errors happen abort API
2896: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2897: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2898: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2893: p_hstv_rec, -- IN
2894: x_hstv_rec); -- OUT
2895: --- If any errors happen abort API
2896: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2897: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2898: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2894: x_hstv_rec); -- OUT
2895: --- If any errors happen abort API
2896: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2897: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2898: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2895: --- If any errors happen abort API
2896: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2897: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2898: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2903: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2898: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2903: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2904: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2905: RAISE OKC_API.G_EXCEPTION_ERROR;
2906: END IF;
2899: RAISE OKC_API.G_EXCEPTION_ERROR;
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2903: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2904: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2905: RAISE OKC_API.G_EXCEPTION_ERROR;
2906: END IF;
2907: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
2900: END IF;
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2903: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2904: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2905: RAISE OKC_API.G_EXCEPTION_ERROR;
2906: END IF;
2907: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
2908: --- Validate all non-missing attributes (Item Level Validation)
2901: l_return_status := populate_new_record(l_hstv_rec, l_def_hstv_rec);
2902: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2903: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2904: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2905: RAISE OKC_API.G_EXCEPTION_ERROR;
2906: END IF;
2907: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
2908: --- Validate all non-missing attributes (Item Level Validation)
2909: l_return_status := Validate_Attributes(l_def_hstv_rec);
2907: l_def_hstv_rec := fill_who_columns(l_def_hstv_rec);
2908: --- Validate all non-missing attributes (Item Level Validation)
2909: l_return_status := Validate_Attributes(l_def_hstv_rec);
2910: --- If any errors happen abort API
2911: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2912: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2913: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2908: --- Validate all non-missing attributes (Item Level Validation)
2909: l_return_status := Validate_Attributes(l_def_hstv_rec);
2910: --- If any errors happen abort API
2911: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2912: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2913: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2909: l_return_status := Validate_Attributes(l_def_hstv_rec);
2910: --- If any errors happen abort API
2911: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2912: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2913: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2910: --- If any errors happen abort API
2911: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2912: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2913: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2918: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2913: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2918: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2919: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2920: RAISE OKC_API.G_EXCEPTION_ERROR;
2921: END IF;
2914: RAISE OKC_API.G_EXCEPTION_ERROR;
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2918: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2919: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2920: RAISE OKC_API.G_EXCEPTION_ERROR;
2921: END IF;
2922:
2915: END IF;
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2918: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2919: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2920: RAISE OKC_API.G_EXCEPTION_ERROR;
2921: END IF;
2922:
2923: -- Lock the Record
2916: l_return_status := Validate_Record(l_def_hstv_rec, l_db_hstv_rec);
2917: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2918: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2919: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2920: RAISE OKC_API.G_EXCEPTION_ERROR;
2921: END IF;
2922:
2923: -- Lock the Record
2924: lock_row(
2927: x_return_status => l_return_status,
2928: x_msg_count => x_msg_count,
2929: x_msg_data => x_msg_data,
2930: p_hstv_rec => p_hstv_rec);
2931: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2932: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2933: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2934: RAISE OKC_API.G_EXCEPTION_ERROR;
2935: END IF;
2928: x_msg_count => x_msg_count,
2929: x_msg_data => x_msg_data,
2930: p_hstv_rec => p_hstv_rec);
2931: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2932: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2933: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2934: RAISE OKC_API.G_EXCEPTION_ERROR;
2935: END IF;
2936:
2929: x_msg_data => x_msg_data,
2930: p_hstv_rec => p_hstv_rec);
2931: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2932: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2933: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2934: RAISE OKC_API.G_EXCEPTION_ERROR;
2935: END IF;
2936:
2937: -----------------------------------------
2930: p_hstv_rec => p_hstv_rec);
2931: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2932: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2933: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2934: RAISE OKC_API.G_EXCEPTION_ERROR;
2935: END IF;
2936:
2937: -----------------------------------------
2938: -- Move VIEW record to "Child" records --
2949: x_msg_data,
2950: l_hst_rec,
2951: lx_hst_rec
2952: );
2953: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2954: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2955: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2956: RAISE OKC_API.G_EXCEPTION_ERROR;
2957: END IF;
2950: l_hst_rec,
2951: lx_hst_rec
2952: );
2953: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2954: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2955: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2956: RAISE OKC_API.G_EXCEPTION_ERROR;
2957: END IF;
2958: migrate(lx_hst_rec, l_def_hstv_rec);
2951: lx_hst_rec
2952: );
2953: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2954: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2955: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2956: RAISE OKC_API.G_EXCEPTION_ERROR;
2957: END IF;
2958: migrate(lx_hst_rec, l_def_hstv_rec);
2959: update_row(
2952: );
2953: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2954: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2955: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2956: RAISE OKC_API.G_EXCEPTION_ERROR;
2957: END IF;
2958: migrate(lx_hst_rec, l_def_hstv_rec);
2959: update_row(
2960: p_init_msg_list,
2963: x_msg_data,
2964: l_okc_k_history_tl_rec,
2965: lx_okc_k_history_tl_rec
2966: );
2967: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2968: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2969: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2970: RAISE OKC_API.G_EXCEPTION_ERROR;
2971: END IF;
2964: l_okc_k_history_tl_rec,
2965: lx_okc_k_history_tl_rec
2966: );
2967: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2968: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2969: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2970: RAISE OKC_API.G_EXCEPTION_ERROR;
2971: END IF;
2972: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
2965: lx_okc_k_history_tl_rec
2966: );
2967: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2968: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2969: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2970: RAISE OKC_API.G_EXCEPTION_ERROR;
2971: END IF;
2972: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
2973: x_hstv_rec := l_def_hstv_rec;
2966: );
2967: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2968: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2969: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2970: RAISE OKC_API.G_EXCEPTION_ERROR;
2971: END IF;
2972: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
2973: x_hstv_rec := l_def_hstv_rec;
2974: x_return_status := l_return_status;
2971: END IF;
2972: migrate(lx_okc_k_history_tl_rec, l_def_hstv_rec);
2973: x_hstv_rec := l_def_hstv_rec;
2974: x_return_status := l_return_status;
2975: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2976: EXCEPTION
2977: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2978: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2979: (
2973: x_hstv_rec := l_def_hstv_rec;
2974: x_return_status := l_return_status;
2975: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2976: EXCEPTION
2977: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2978: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2979: (
2980: l_api_name,
2981: G_PKG_NAME,
2974: x_return_status := l_return_status;
2975: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2976: EXCEPTION
2977: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2978: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2979: (
2980: l_api_name,
2981: G_PKG_NAME,
2982: 'OKC_API.G_RET_STS_ERROR',
2978: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2979: (
2980: l_api_name,
2981: G_PKG_NAME,
2982: 'OKC_API.G_RET_STS_ERROR',
2983: x_msg_count,
2984: x_msg_data,
2985: '_PVT'
2986: );
2983: x_msg_count,
2984: x_msg_data,
2985: '_PVT'
2986: );
2987: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2989: (
2990: l_api_name,
2991: G_PKG_NAME,
2984: x_msg_data,
2985: '_PVT'
2986: );
2987: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2989: (
2990: l_api_name,
2991: G_PKG_NAME,
2992: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2988: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2989: (
2990: l_api_name,
2991: G_PKG_NAME,
2992: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2993: x_msg_count,
2994: x_msg_data,
2995: '_PVT'
2996: );
2994: x_msg_data,
2995: '_PVT'
2996: );
2997: WHEN OTHERS THEN
2998: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2999: (
3000: l_api_name,
3001: G_PKG_NAME,
3002: 'OTHERS',
3015: x_msg_count OUT NOCOPY NUMBER,
3016: x_msg_data OUT NOCOPY VARCHAR2,
3017: p_hstv_tbl IN hstv_tbl_type,
3018: x_hstv_tbl OUT NOCOPY hstv_tbl_type,
3019: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
3020:
3021: l_api_version CONSTANT NUMBER := 1;
3022: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_update_row';
3023: i NUMBER := 0;
3021: l_api_version CONSTANT NUMBER := 1;
3022: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_update_row';
3023: i NUMBER := 0;
3024: BEGIN
3025: OKC_API.init_msg_list(p_init_msg_list);
3026: -- Make sure PL/SQL table has records in it before passing
3027: IF (p_hstv_tbl.COUNT > 0) THEN
3028: i := p_hstv_tbl.FIRST;
3029: LOOP
3027: IF (p_hstv_tbl.COUNT > 0) THEN
3028: i := p_hstv_tbl.FIRST;
3029: LOOP
3030: DECLARE
3031: l_error_rec OKC_API.ERROR_REC_TYPE;
3032: BEGIN
3033: l_error_rec.api_name := l_api_name;
3034: l_error_rec.api_package := G_PKG_NAME;
3035: l_error_rec.idx := i;
3034: l_error_rec.api_package := G_PKG_NAME;
3035: l_error_rec.idx := i;
3036: update_row (
3037: p_api_version => p_api_version,
3038: p_init_msg_list => OKC_API.G_FALSE,
3039: x_return_status => l_error_rec.error_type,
3040: x_msg_count => l_error_rec.msg_count,
3041: x_msg_data => l_error_rec.msg_data,
3042: p_hstv_rec => p_hstv_tbl(i),
3040: x_msg_count => l_error_rec.msg_count,
3041: x_msg_data => l_error_rec.msg_data,
3042: p_hstv_rec => p_hstv_tbl(i),
3043: x_hstv_rec => x_hstv_tbl(i));
3044: IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
3045: l_error_rec.sqlcode := SQLCODE;
3046: load_error_tbl(l_error_rec, px_error_tbl);
3047: ELSE
3048: x_msg_count := l_error_rec.msg_count;
3048: x_msg_count := l_error_rec.msg_count;
3049: x_msg_data := l_error_rec.msg_data;
3050: END IF;
3051: EXCEPTION
3052: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3053: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3054: l_error_rec.sqlcode := SQLCODE;
3055: load_error_tbl(l_error_rec, px_error_tbl);
3056: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3049: x_msg_data := l_error_rec.msg_data;
3050: END IF;
3051: EXCEPTION
3052: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3053: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3054: l_error_rec.sqlcode := SQLCODE;
3055: load_error_tbl(l_error_rec, px_error_tbl);
3056: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3057: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3052: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3053: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3054: l_error_rec.sqlcode := SQLCODE;
3055: load_error_tbl(l_error_rec, px_error_tbl);
3056: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3057: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3058: l_error_rec.sqlcode := SQLCODE;
3059: load_error_tbl(l_error_rec, px_error_tbl);
3060: WHEN OTHERS THEN
3053: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3054: l_error_rec.sqlcode := SQLCODE;
3055: load_error_tbl(l_error_rec, px_error_tbl);
3056: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3057: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3058: l_error_rec.sqlcode := SQLCODE;
3059: load_error_tbl(l_error_rec, px_error_tbl);
3060: WHEN OTHERS THEN
3061: l_error_rec.error_type := 'OTHERS';
3068: END IF;
3069: -- Loop through the error_tbl to find the error with the highest severity
3070: -- and return it.
3071: x_return_status := find_highest_exception(px_error_tbl);
3072: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3073: EXCEPTION
3074: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3075: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3076: (
3070: -- and return it.
3071: x_return_status := find_highest_exception(px_error_tbl);
3072: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3073: EXCEPTION
3074: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3075: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3076: (
3077: l_api_name,
3078: G_PKG_NAME,
3071: x_return_status := find_highest_exception(px_error_tbl);
3072: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3073: EXCEPTION
3074: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3075: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3076: (
3077: l_api_name,
3078: G_PKG_NAME,
3079: 'OKC_API.G_RET_STS_ERROR',
3075: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3076: (
3077: l_api_name,
3078: G_PKG_NAME,
3079: 'OKC_API.G_RET_STS_ERROR',
3080: x_msg_count,
3081: x_msg_data,
3082: '_PVT'
3083: );
3080: x_msg_count,
3081: x_msg_data,
3082: '_PVT'
3083: );
3084: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3085: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3086: (
3087: l_api_name,
3088: G_PKG_NAME,
3081: x_msg_data,
3082: '_PVT'
3083: );
3084: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3085: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3086: (
3087: l_api_name,
3088: G_PKG_NAME,
3089: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3085: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3086: (
3087: l_api_name,
3088: G_PKG_NAME,
3089: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3090: x_msg_count,
3091: x_msg_data,
3092: '_PVT'
3093: );
3091: x_msg_data,
3092: '_PVT'
3093: );
3094: WHEN OTHERS THEN
3095: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3096: (
3097: l_api_name,
3098: G_PKG_NAME,
3099: 'OTHERS',
3116: x_hstv_tbl OUT NOCOPY hstv_tbl_type) IS
3117:
3118: l_api_version CONSTANT NUMBER := 1;
3119: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3120: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3121: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3122: BEGIN
3123: OKC_API.init_msg_list(p_init_msg_list);
3124: -- Make sure PL/SQL table has records in it before passing
3117:
3118: l_api_version CONSTANT NUMBER := 1;
3119: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3120: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3121: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3122: BEGIN
3123: OKC_API.init_msg_list(p_init_msg_list);
3124: -- Make sure PL/SQL table has records in it before passing
3125: IF (p_hstv_tbl.COUNT > 0) THEN
3119: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3120: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3121: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3122: BEGIN
3123: OKC_API.init_msg_list(p_init_msg_list);
3124: -- Make sure PL/SQL table has records in it before passing
3125: IF (p_hstv_tbl.COUNT > 0) THEN
3126: update_row (
3127: p_api_version => p_api_version,
3124: -- Make sure PL/SQL table has records in it before passing
3125: IF (p_hstv_tbl.COUNT > 0) THEN
3126: update_row (
3127: p_api_version => p_api_version,
3128: p_init_msg_list => OKC_API.G_FALSE,
3129: x_return_status => x_return_status,
3130: x_msg_count => x_msg_count,
3131: x_msg_data => x_msg_data,
3132: p_hstv_tbl => p_hstv_tbl,
3132: p_hstv_tbl => p_hstv_tbl,
3133: x_hstv_tbl => x_hstv_tbl,
3134: px_error_tbl => l_error_tbl);
3135: END IF;
3136: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3137: EXCEPTION
3138: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3139: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3140: (
3134: px_error_tbl => l_error_tbl);
3135: END IF;
3136: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3137: EXCEPTION
3138: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3139: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3140: (
3141: l_api_name,
3142: G_PKG_NAME,
3135: END IF;
3136: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3137: EXCEPTION
3138: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3139: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3140: (
3141: l_api_name,
3142: G_PKG_NAME,
3143: 'OKC_API.G_RET_STS_ERROR',
3139: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3140: (
3141: l_api_name,
3142: G_PKG_NAME,
3143: 'OKC_API.G_RET_STS_ERROR',
3144: x_msg_count,
3145: x_msg_data,
3146: '_PVT'
3147: );
3144: x_msg_count,
3145: x_msg_data,
3146: '_PVT'
3147: );
3148: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3149: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3150: (
3151: l_api_name,
3152: G_PKG_NAME,
3145: x_msg_data,
3146: '_PVT'
3147: );
3148: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3149: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3150: (
3151: l_api_name,
3152: G_PKG_NAME,
3153: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3149: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3150: (
3151: l_api_name,
3152: G_PKG_NAME,
3153: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3154: x_msg_count,
3155: x_msg_data,
3156: '_PVT'
3157: );
3155: x_msg_data,
3156: '_PVT'
3157: );
3158: WHEN OTHERS THEN
3159: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3160: (
3161: l_api_name,
3162: G_PKG_NAME,
3163: 'OTHERS',
3181: p_hst_rec IN hst_rec_type) IS
3182:
3183: l_api_version CONSTANT NUMBER := 1;
3184: l_api_name CONSTANT VARCHAR2(30) := 'B_delete_row';
3185: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3186: l_hst_rec hst_rec_type := p_hst_rec;
3187: l_row_notfound BOOLEAN := TRUE;
3188: BEGIN
3189: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3185: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3186: l_hst_rec hst_rec_type := p_hst_rec;
3187: l_row_notfound BOOLEAN := TRUE;
3188: BEGIN
3189: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3190: p_init_msg_list,
3191: '_PVT',
3192: x_return_status);
3193: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3189: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3190: p_init_msg_list,
3191: '_PVT',
3192: x_return_status);
3193: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3194: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3195: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3196: RAISE OKC_API.G_EXCEPTION_ERROR;
3197: END IF;
3190: p_init_msg_list,
3191: '_PVT',
3192: x_return_status);
3193: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3194: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3195: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3196: RAISE OKC_API.G_EXCEPTION_ERROR;
3197: END IF;
3198:
3191: '_PVT',
3192: x_return_status);
3193: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3194: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3195: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3196: RAISE OKC_API.G_EXCEPTION_ERROR;
3197: END IF;
3198:
3199: DELETE FROM OKC_K_HISTORY_B
3192: x_return_status);
3193: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3194: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3195: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3196: RAISE OKC_API.G_EXCEPTION_ERROR;
3197: END IF;
3198:
3199: DELETE FROM OKC_K_HISTORY_B
3200: WHERE ID = p_hst_rec.id;
3199: DELETE FROM OKC_K_HISTORY_B
3200: WHERE ID = p_hst_rec.id;
3201:
3202: x_return_status := l_return_status;
3203: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3204: EXCEPTION
3205: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3206: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3207: (
3201:
3202: x_return_status := l_return_status;
3203: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3204: EXCEPTION
3205: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3206: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3207: (
3208: l_api_name,
3209: G_PKG_NAME,
3202: x_return_status := l_return_status;
3203: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3204: EXCEPTION
3205: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3206: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3207: (
3208: l_api_name,
3209: G_PKG_NAME,
3210: 'OKC_API.G_RET_STS_ERROR',
3206: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3207: (
3208: l_api_name,
3209: G_PKG_NAME,
3210: 'OKC_API.G_RET_STS_ERROR',
3211: x_msg_count,
3212: x_msg_data,
3213: '_PVT'
3214: );
3211: x_msg_count,
3212: x_msg_data,
3213: '_PVT'
3214: );
3215: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3216: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3217: (
3218: l_api_name,
3219: G_PKG_NAME,
3212: x_msg_data,
3213: '_PVT'
3214: );
3215: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3216: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3217: (
3218: l_api_name,
3219: G_PKG_NAME,
3220: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3216: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3217: (
3218: l_api_name,
3219: G_PKG_NAME,
3220: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3221: x_msg_count,
3222: x_msg_data,
3223: '_PVT'
3224: );
3222: x_msg_data,
3223: '_PVT'
3224: );
3225: WHEN OTHERS THEN
3226: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3227: (
3228: l_api_name,
3229: G_PKG_NAME,
3230: 'OTHERS',
3244: p_okc_k_history_tl_rec IN okc_k_history_tl_rec_type) IS
3245:
3246: l_api_version CONSTANT NUMBER := 1;
3247: l_api_name CONSTANT VARCHAR2(30) := 'TL_delete_row';
3248: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3249: l_okc_k_history_tl_rec okc_k_history_tl_rec_type := p_okc_k_history_tl_rec;
3250: l_row_notfound BOOLEAN := TRUE;
3251: BEGIN
3252: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3248: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3249: l_okc_k_history_tl_rec okc_k_history_tl_rec_type := p_okc_k_history_tl_rec;
3250: l_row_notfound BOOLEAN := TRUE;
3251: BEGIN
3252: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3253: p_init_msg_list,
3254: '_PVT',
3255: x_return_status);
3256: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3252: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3253: p_init_msg_list,
3254: '_PVT',
3255: x_return_status);
3256: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3257: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3258: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3259: RAISE OKC_API.G_EXCEPTION_ERROR;
3260: END IF;
3253: p_init_msg_list,
3254: '_PVT',
3255: x_return_status);
3256: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3257: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3258: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3259: RAISE OKC_API.G_EXCEPTION_ERROR;
3260: END IF;
3261:
3254: '_PVT',
3255: x_return_status);
3256: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3257: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3258: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3259: RAISE OKC_API.G_EXCEPTION_ERROR;
3260: END IF;
3261:
3262: DELETE FROM OKC_K_HISTORY_TL
3255: x_return_status);
3256: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3257: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3258: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3259: RAISE OKC_API.G_EXCEPTION_ERROR;
3260: END IF;
3261:
3262: DELETE FROM OKC_K_HISTORY_TL
3263: WHERE ID = p_okc_k_history_tl_rec.id;
3262: DELETE FROM OKC_K_HISTORY_TL
3263: WHERE ID = p_okc_k_history_tl_rec.id;
3264:
3265: x_return_status := l_return_status;
3266: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3267: EXCEPTION
3268: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3269: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3270: (
3264:
3265: x_return_status := l_return_status;
3266: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3267: EXCEPTION
3268: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3269: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3270: (
3271: l_api_name,
3272: G_PKG_NAME,
3265: x_return_status := l_return_status;
3266: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3267: EXCEPTION
3268: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3269: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3270: (
3271: l_api_name,
3272: G_PKG_NAME,
3273: 'OKC_API.G_RET_STS_ERROR',
3269: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3270: (
3271: l_api_name,
3272: G_PKG_NAME,
3273: 'OKC_API.G_RET_STS_ERROR',
3274: x_msg_count,
3275: x_msg_data,
3276: '_PVT'
3277: );
3274: x_msg_count,
3275: x_msg_data,
3276: '_PVT'
3277: );
3278: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3279: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3280: (
3281: l_api_name,
3282: G_PKG_NAME,
3275: x_msg_data,
3276: '_PVT'
3277: );
3278: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3279: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3280: (
3281: l_api_name,
3282: G_PKG_NAME,
3283: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3279: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3280: (
3281: l_api_name,
3282: G_PKG_NAME,
3283: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3284: x_msg_count,
3285: x_msg_data,
3286: '_PVT'
3287: );
3285: x_msg_data,
3286: '_PVT'
3287: );
3288: WHEN OTHERS THEN
3289: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3290: (
3291: l_api_name,
3292: G_PKG_NAME,
3293: 'OTHERS',
3308: p_hstv_rec IN hstv_rec_type) IS
3309:
3310: l_api_version CONSTANT NUMBER := 1;
3311: l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
3312: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3313: l_hstv_rec hstv_rec_type := p_hstv_rec;
3314: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
3315: l_hst_rec hst_rec_type;
3316: BEGIN
3313: l_hstv_rec hstv_rec_type := p_hstv_rec;
3314: l_okc_k_history_tl_rec okc_k_history_tl_rec_type;
3315: l_hst_rec hst_rec_type;
3316: BEGIN
3317: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3318: G_PKG_NAME,
3319: p_init_msg_list,
3320: l_api_version,
3321: p_api_version,
3320: l_api_version,
3321: p_api_version,
3322: '_PVT',
3323: x_return_status);
3324: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3325: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3326: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3327: RAISE OKC_API.G_EXCEPTION_ERROR;
3328: END IF;
3321: p_api_version,
3322: '_PVT',
3323: x_return_status);
3324: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3325: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3326: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3327: RAISE OKC_API.G_EXCEPTION_ERROR;
3328: END IF;
3329: -----------------------------------------
3322: '_PVT',
3323: x_return_status);
3324: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3325: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3326: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3327: RAISE OKC_API.G_EXCEPTION_ERROR;
3328: END IF;
3329: -----------------------------------------
3330: -- Move VIEW record to "Child" records --
3323: x_return_status);
3324: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3325: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3326: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3327: RAISE OKC_API.G_EXCEPTION_ERROR;
3328: END IF;
3329: -----------------------------------------
3330: -- Move VIEW record to "Child" records --
3331: -----------------------------------------
3340: x_msg_count,
3341: x_msg_data,
3342: l_okc_k_history_tl_rec
3343: );
3344: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3345: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3346: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3347: RAISE OKC_API.G_EXCEPTION_ERROR;
3348: END IF;
3341: x_msg_data,
3342: l_okc_k_history_tl_rec
3343: );
3344: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3345: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3346: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3347: RAISE OKC_API.G_EXCEPTION_ERROR;
3348: END IF;
3349: delete_row(
3342: l_okc_k_history_tl_rec
3343: );
3344: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3345: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3346: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3347: RAISE OKC_API.G_EXCEPTION_ERROR;
3348: END IF;
3349: delete_row(
3350: p_init_msg_list,
3343: );
3344: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3345: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3346: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3347: RAISE OKC_API.G_EXCEPTION_ERROR;
3348: END IF;
3349: delete_row(
3350: p_init_msg_list,
3351: l_return_status,
3352: x_msg_count,
3353: x_msg_data,
3354: l_hst_rec
3355: );
3356: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3357: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3358: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3359: RAISE OKC_API.G_EXCEPTION_ERROR;
3360: END IF;
3353: x_msg_data,
3354: l_hst_rec
3355: );
3356: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3357: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3358: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3359: RAISE OKC_API.G_EXCEPTION_ERROR;
3360: END IF;
3361: x_return_status := l_return_status;
3354: l_hst_rec
3355: );
3356: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3357: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3358: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3359: RAISE OKC_API.G_EXCEPTION_ERROR;
3360: END IF;
3361: x_return_status := l_return_status;
3362: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3355: );
3356: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3357: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3358: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3359: RAISE OKC_API.G_EXCEPTION_ERROR;
3360: END IF;
3361: x_return_status := l_return_status;
3362: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3363: EXCEPTION
3358: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3359: RAISE OKC_API.G_EXCEPTION_ERROR;
3360: END IF;
3361: x_return_status := l_return_status;
3362: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3363: EXCEPTION
3364: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3365: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3366: (
3360: END IF;
3361: x_return_status := l_return_status;
3362: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3363: EXCEPTION
3364: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3365: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3366: (
3367: l_api_name,
3368: G_PKG_NAME,
3361: x_return_status := l_return_status;
3362: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3363: EXCEPTION
3364: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3365: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3366: (
3367: l_api_name,
3368: G_PKG_NAME,
3369: 'OKC_API.G_RET_STS_ERROR',
3365: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3366: (
3367: l_api_name,
3368: G_PKG_NAME,
3369: 'OKC_API.G_RET_STS_ERROR',
3370: x_msg_count,
3371: x_msg_data,
3372: '_PVT'
3373: );
3370: x_msg_count,
3371: x_msg_data,
3372: '_PVT'
3373: );
3374: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3375: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3376: (
3377: l_api_name,
3378: G_PKG_NAME,
3371: x_msg_data,
3372: '_PVT'
3373: );
3374: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3375: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3376: (
3377: l_api_name,
3378: G_PKG_NAME,
3379: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3375: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3376: (
3377: l_api_name,
3378: G_PKG_NAME,
3379: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3380: x_msg_count,
3381: x_msg_data,
3382: '_PVT'
3383: );
3381: x_msg_data,
3382: '_PVT'
3383: );
3384: WHEN OTHERS THEN
3385: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3386: (
3387: l_api_name,
3388: G_PKG_NAME,
3389: 'OTHERS',
3401: x_return_status OUT NOCOPY VARCHAR2,
3402: x_msg_count OUT NOCOPY NUMBER,
3403: x_msg_data OUT NOCOPY VARCHAR2,
3404: p_hstv_tbl IN hstv_tbl_type,
3405: px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
3406:
3407: l_api_version CONSTANT NUMBER := 1;
3408: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_delete_row';
3409: i NUMBER := 0;
3407: l_api_version CONSTANT NUMBER := 1;
3408: l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_delete_row';
3409: i NUMBER := 0;
3410: BEGIN
3411: OKC_API.init_msg_list(p_init_msg_list);
3412: -- Make sure PL/SQL table has records in it before passing
3413: IF (p_hstv_tbl.COUNT > 0) THEN
3414: i := p_hstv_tbl.FIRST;
3415: LOOP
3413: IF (p_hstv_tbl.COUNT > 0) THEN
3414: i := p_hstv_tbl.FIRST;
3415: LOOP
3416: DECLARE
3417: l_error_rec OKC_API.ERROR_REC_TYPE;
3418: BEGIN
3419: l_error_rec.api_name := l_api_name;
3420: l_error_rec.api_package := G_PKG_NAME;
3421: l_error_rec.idx := i;
3420: l_error_rec.api_package := G_PKG_NAME;
3421: l_error_rec.idx := i;
3422: delete_row (
3423: p_api_version => p_api_version,
3424: p_init_msg_list => OKC_API.G_FALSE,
3425: x_return_status => l_error_rec.error_type,
3426: x_msg_count => l_error_rec.msg_count,
3427: x_msg_data => l_error_rec.msg_data,
3428: p_hstv_rec => p_hstv_tbl(i));
3425: x_return_status => l_error_rec.error_type,
3426: x_msg_count => l_error_rec.msg_count,
3427: x_msg_data => l_error_rec.msg_data,
3428: p_hstv_rec => p_hstv_tbl(i));
3429: IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
3430: l_error_rec.sqlcode := SQLCODE;
3431: load_error_tbl(l_error_rec, px_error_tbl);
3432: ELSE
3433: x_msg_count := l_error_rec.msg_count;
3433: x_msg_count := l_error_rec.msg_count;
3434: x_msg_data := l_error_rec.msg_data;
3435: END IF;
3436: EXCEPTION
3437: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3438: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3439: l_error_rec.sqlcode := SQLCODE;
3440: load_error_tbl(l_error_rec, px_error_tbl);
3441: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3434: x_msg_data := l_error_rec.msg_data;
3435: END IF;
3436: EXCEPTION
3437: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3438: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3439: l_error_rec.sqlcode := SQLCODE;
3440: load_error_tbl(l_error_rec, px_error_tbl);
3441: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3442: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3437: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3438: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3439: l_error_rec.sqlcode := SQLCODE;
3440: load_error_tbl(l_error_rec, px_error_tbl);
3441: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3442: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3443: l_error_rec.sqlcode := SQLCODE;
3444: load_error_tbl(l_error_rec, px_error_tbl);
3445: WHEN OTHERS THEN
3438: l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
3439: l_error_rec.sqlcode := SQLCODE;
3440: load_error_tbl(l_error_rec, px_error_tbl);
3441: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3442: l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
3443: l_error_rec.sqlcode := SQLCODE;
3444: load_error_tbl(l_error_rec, px_error_tbl);
3445: WHEN OTHERS THEN
3446: l_error_rec.error_type := 'OTHERS';
3453: END IF;
3454: -- Loop through the error_tbl to find the error with the highest severity
3455: -- and return it.
3456: x_return_status := find_highest_exception(px_error_tbl);
3457: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3458: EXCEPTION
3459: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3460: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3461: (
3455: -- and return it.
3456: x_return_status := find_highest_exception(px_error_tbl);
3457: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3458: EXCEPTION
3459: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3460: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3461: (
3462: l_api_name,
3463: G_PKG_NAME,
3456: x_return_status := find_highest_exception(px_error_tbl);
3457: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3458: EXCEPTION
3459: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3460: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3461: (
3462: l_api_name,
3463: G_PKG_NAME,
3464: 'OKC_API.G_RET_STS_ERROR',
3460: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3461: (
3462: l_api_name,
3463: G_PKG_NAME,
3464: 'OKC_API.G_RET_STS_ERROR',
3465: x_msg_count,
3466: x_msg_data,
3467: '_PVT'
3468: );
3465: x_msg_count,
3466: x_msg_data,
3467: '_PVT'
3468: );
3469: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3470: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3471: (
3472: l_api_name,
3473: G_PKG_NAME,
3466: x_msg_data,
3467: '_PVT'
3468: );
3469: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3470: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3471: (
3472: l_api_name,
3473: G_PKG_NAME,
3474: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3470: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3471: (
3472: l_api_name,
3473: G_PKG_NAME,
3474: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3475: x_msg_count,
3476: x_msg_data,
3477: '_PVT'
3478: );
3476: x_msg_data,
3477: '_PVT'
3478: );
3479: WHEN OTHERS THEN
3480: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3481: (
3482: l_api_name,
3483: G_PKG_NAME,
3484: 'OTHERS',
3500: p_hstv_tbl IN hstv_tbl_type) IS
3501:
3502: l_api_version CONSTANT NUMBER := 1;
3503: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3504: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3505: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3506: BEGIN
3507: OKC_API.init_msg_list(p_init_msg_list);
3508: -- Make sure PL/SQL table has records in it before passing
3501:
3502: l_api_version CONSTANT NUMBER := 1;
3503: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3504: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3505: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3506: BEGIN
3507: OKC_API.init_msg_list(p_init_msg_list);
3508: -- Make sure PL/SQL table has records in it before passing
3509: IF (p_hstv_tbl.COUNT > 0) THEN
3503: l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3504: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3505: l_error_tbl OKC_API.ERROR_TBL_TYPE;
3506: BEGIN
3507: OKC_API.init_msg_list(p_init_msg_list);
3508: -- Make sure PL/SQL table has records in it before passing
3509: IF (p_hstv_tbl.COUNT > 0) THEN
3510: delete_row (
3511: p_api_version => p_api_version,
3508: -- Make sure PL/SQL table has records in it before passing
3509: IF (p_hstv_tbl.COUNT > 0) THEN
3510: delete_row (
3511: p_api_version => p_api_version,
3512: p_init_msg_list => OKC_API.G_FALSE,
3513: x_return_status => x_return_status,
3514: x_msg_count => x_msg_count,
3515: x_msg_data => x_msg_data,
3516: p_hstv_tbl => p_hstv_tbl,
3515: x_msg_data => x_msg_data,
3516: p_hstv_tbl => p_hstv_tbl,
3517: px_error_tbl => l_error_tbl);
3518: END IF;
3519: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3520: EXCEPTION
3521: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3522: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3523: (
3517: px_error_tbl => l_error_tbl);
3518: END IF;
3519: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3520: EXCEPTION
3521: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3522: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3523: (
3524: l_api_name,
3525: G_PKG_NAME,
3518: END IF;
3519: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3520: EXCEPTION
3521: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3522: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3523: (
3524: l_api_name,
3525: G_PKG_NAME,
3526: 'OKC_API.G_RET_STS_ERROR',
3522: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3523: (
3524: l_api_name,
3525: G_PKG_NAME,
3526: 'OKC_API.G_RET_STS_ERROR',
3527: x_msg_count,
3528: x_msg_data,
3529: '_PVT'
3530: );
3527: x_msg_count,
3528: x_msg_data,
3529: '_PVT'
3530: );
3531: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3532: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3533: (
3534: l_api_name,
3535: G_PKG_NAME,
3528: x_msg_data,
3529: '_PVT'
3530: );
3531: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3532: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3533: (
3534: l_api_name,
3535: G_PKG_NAME,
3536: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3532: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3533: (
3534: l_api_name,
3535: G_PKG_NAME,
3536: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3537: x_msg_count,
3538: x_msg_data,
3539: '_PVT'
3540: );
3538: x_msg_data,
3539: '_PVT'
3540: );
3541: WHEN OTHERS THEN
3542: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3543: (
3544: l_api_name,
3545: G_PKG_NAME,
3546: 'OTHERS',
3565: p_chr_id IN NUMBER) IS
3566:
3567: l_api_version CONSTANT NUMBER := 1;
3568: l_api_name CONSTANT VARCHAR2(30) := 'TL_delete_all_rows';
3569: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3570: l_row_notfound BOOLEAN := TRUE;
3571:
3572: BEGIN
3573: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3569: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3570: l_row_notfound BOOLEAN := TRUE;
3571:
3572: BEGIN
3573: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3574: p_init_msg_list,
3575: '_PVT',
3576: x_return_status);
3577: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3573: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3574: p_init_msg_list,
3575: '_PVT',
3576: x_return_status);
3577: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3578: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3579: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3580: RAISE OKC_API.G_EXCEPTION_ERROR;
3581: END IF;
3574: p_init_msg_list,
3575: '_PVT',
3576: x_return_status);
3577: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3578: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3579: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3580: RAISE OKC_API.G_EXCEPTION_ERROR;
3581: END IF;
3582:
3575: '_PVT',
3576: x_return_status);
3577: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3578: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3579: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3580: RAISE OKC_API.G_EXCEPTION_ERROR;
3581: END IF;
3582:
3583: DELETE FROM OKC_K_HISTORY_TL
3576: x_return_status);
3577: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3578: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3579: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3580: RAISE OKC_API.G_EXCEPTION_ERROR;
3581: END IF;
3582:
3583: DELETE FROM OKC_K_HISTORY_TL
3584: WHERE ID IN (SELECT ID
3588: DELETE FROM OKC_K_HISTORY_B
3589: WHERE CHR_ID = p_chr_id;
3590:
3591: x_return_status := l_return_status;
3592: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3593: EXCEPTION
3594: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3595: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3596: (
3590:
3591: x_return_status := l_return_status;
3592: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3593: EXCEPTION
3594: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3595: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3596: (
3597: l_api_name,
3598: G_PKG_NAME,
3591: x_return_status := l_return_status;
3592: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3593: EXCEPTION
3594: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3595: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3596: (
3597: l_api_name,
3598: G_PKG_NAME,
3599: 'OKC_API.G_RET_STS_ERROR',
3595: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3596: (
3597: l_api_name,
3598: G_PKG_NAME,
3599: 'OKC_API.G_RET_STS_ERROR',
3600: x_msg_count,
3601: x_msg_data,
3602: '_PVT'
3603: );
3600: x_msg_count,
3601: x_msg_data,
3602: '_PVT'
3603: );
3604: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3605: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3606: (
3607: l_api_name,
3608: G_PKG_NAME,
3601: x_msg_data,
3602: '_PVT'
3603: );
3604: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3605: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3606: (
3607: l_api_name,
3608: G_PKG_NAME,
3609: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3605: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3606: (
3607: l_api_name,
3608: G_PKG_NAME,
3609: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3610: x_msg_count,
3611: x_msg_data,
3612: '_PVT'
3613: );
3611: x_msg_data,
3612: '_PVT'
3613: );
3614: WHEN OTHERS THEN
3615: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3616: (
3617: l_api_name,
3618: G_PKG_NAME,
3619: 'OTHERS',
3634: p_chr_id IN NUMBER) IS
3635:
3636: l_api_version CONSTANT NUMBER := 1;
3637: l_api_name CONSTANT VARCHAR2(30) := 'V_delete_all_rows';
3638: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3639: BEGIN
3640: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3641: G_PKG_NAME,
3642: p_init_msg_list,
3636: l_api_version CONSTANT NUMBER := 1;
3637: l_api_name CONSTANT VARCHAR2(30) := 'V_delete_all_rows';
3638: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3639: BEGIN
3640: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3641: G_PKG_NAME,
3642: p_init_msg_list,
3643: l_api_version,
3644: p_api_version,
3643: l_api_version,
3644: p_api_version,
3645: '_PVT',
3646: x_return_status);
3647: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3648: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3649: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3650: RAISE OKC_API.G_EXCEPTION_ERROR;
3651: END IF;
3644: p_api_version,
3645: '_PVT',
3646: x_return_status);
3647: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3648: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3649: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3650: RAISE OKC_API.G_EXCEPTION_ERROR;
3651: END IF;
3652:
3645: '_PVT',
3646: x_return_status);
3647: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3648: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3649: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3650: RAISE OKC_API.G_EXCEPTION_ERROR;
3651: END IF;
3652:
3653: --------------------------------------------------
3646: x_return_status);
3647: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3648: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3649: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3650: RAISE OKC_API.G_EXCEPTION_ERROR;
3651: END IF;
3652:
3653: --------------------------------------------------
3654: -- Call the DELETE_ALL_ROWS for all the records --
3658: l_return_status,
3659: x_msg_count,
3660: x_msg_data,
3661: p_chr_id );
3662: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3663: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3664: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3665: RAISE OKC_API.G_EXCEPTION_ERROR;
3666: END IF;
3659: x_msg_count,
3660: x_msg_data,
3661: p_chr_id );
3662: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3663: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3664: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3665: RAISE OKC_API.G_EXCEPTION_ERROR;
3666: END IF;
3667:
3660: x_msg_data,
3661: p_chr_id );
3662: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3663: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3664: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3665: RAISE OKC_API.G_EXCEPTION_ERROR;
3666: END IF;
3667:
3668: x_return_status := l_return_status;
3661: p_chr_id );
3662: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3663: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3664: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3665: RAISE OKC_API.G_EXCEPTION_ERROR;
3666: END IF;
3667:
3668: x_return_status := l_return_status;
3669: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3665: RAISE OKC_API.G_EXCEPTION_ERROR;
3666: END IF;
3667:
3668: x_return_status := l_return_status;
3669: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3670: EXCEPTION
3671: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3672: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3673: (
3667:
3668: x_return_status := l_return_status;
3669: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3670: EXCEPTION
3671: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3672: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3673: (
3674: l_api_name,
3675: G_PKG_NAME,
3668: x_return_status := l_return_status;
3669: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3670: EXCEPTION
3671: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3672: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3673: (
3674: l_api_name,
3675: G_PKG_NAME,
3676: 'OKC_API.G_RET_STS_ERROR',
3672: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3673: (
3674: l_api_name,
3675: G_PKG_NAME,
3676: 'OKC_API.G_RET_STS_ERROR',
3677: x_msg_count,
3678: x_msg_data,
3679: '_PVT'
3680: );
3677: x_msg_count,
3678: x_msg_data,
3679: '_PVT'
3680: );
3681: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3682: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3683: (
3684: l_api_name,
3685: G_PKG_NAME,
3678: x_msg_data,
3679: '_PVT'
3680: );
3681: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3682: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3683: (
3684: l_api_name,
3685: G_PKG_NAME,
3686: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3682: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3683: (
3684: l_api_name,
3685: G_PKG_NAME,
3686: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3687: x_msg_count,
3688: x_msg_data,
3689: '_PVT'
3690: );
3688: x_msg_data,
3689: '_PVT'
3690: );
3691: WHEN OTHERS THEN
3692: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3693: (
3694: l_api_name,
3695: G_PKG_NAME,
3696: 'OTHERS',