The following lines contain the word 'select', 'insert', 'update' or 'delete':
| PRIVATE PROCEDURE InsertErrors
|
| DESCRIPTION
| This procedure logs debug messages to db and to CM log
|
| CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
|
| CALLS PROCEDURES/FUNCTIONS (local to this package body)
| None
|
| PARAMETERS
| p_msg_level IN Debug msg level
| p_msg IN Debug msg itself
|
| KNOWN ISSUES
| None
|
|
| NOTES
| Any interesting aspect of the code in the package body which needs
| to be stated.
|
| MODIFICATION HISTORY
| Date Author Description of Changes
| 28-Mar-2007 MBOLLI Created
|
*=======================================================================*/
Procedure InsertErrors
IS
BEGIN
FORALL i in 1..g_errors_rec.COUNT
insert into LNS_LOAN_API_ERRORS_GT
VALUES
g_errors_rec(i);
SELECT
loan_class_code, loan_status, secondary_status, credit_review_flag, current_phase, open_to_term_event
FROM
lns_loan_headers
WHERE
loan_id = p_loan_id;
--SELECT VALIDATE_LOAN(l_loan_id) into l_validate_loan FROM DUAL;
--SELECT IS_LOAN_AMOUNT_VALID(l_loan_id) into l_amount_valid FROM DUAL;
--SELECT IS_LOAN_TO_VALUE_MET(l_loan_id) into l_loan_value_met FROM DUAL;
--SELECT IS_COLLATERAL_EXIST(l_loan_id) into l_collateral_exist FROM DUAL;
SELECT
to_char(loan.collateral_percent) || '%' into l_collateral_percent
FROM
lns_loan_headers loan
WHERE
loan.loan_id = l_loan_id;
InsertErrors;
InsertErrors;
InsertErrors;
SELECT
count(1) into l_count
FROM
lns_fee_assignments
WHERE
loan_id = p_loan_id
and end_installment_number > lns_fin_utils.getnumberinstallments(p_loan_id);
SELECT
count(1)
FROM
lns_loan_headers loan
WHERE
loan.loan_id = p_loan_id
and (loan.loan_subtype <> 'SECURED'
OR loan.collateral_percent <=
(SELECT
nvl(sum(a.pledged_amount)/loan.requested_amount,0) * 100
FROM
lns_asset_assignments a
WHERE
a.loan_id = loan.loan_id
and ( a.end_date_active is null OR trunc(a.end_date_active) >= trunc(loan.loan_maturity_date) )
)
);
SELECT
COUNT(1)
FROM
lns_loan_headers l
WHERE
l.loan_Id = p_loan_id
and (l.loan_subtype <> 'SECURED'
OR exists
(SELECT
1
FROM
lns_asset_assignments a
WHERE
a.loan_id = l.loan_id
)
);
SELECT
count(1) into l_count
FROM
lns_cond_assignments
WHERE
loan_id = p_loan_id
and mandatory_flag = 'Y'
and (condition_met_flag is NULL OR condition_met_flag = 'N')
and (end_date_active is null or end_date_active > sysdate)
and condition_id NOT IN
(SELECT
condition_id
FROM
lns_conditions
WHERE
condition_type = l_condition_type
);
SELECT
NVL(LOAN_APPR_REQ_FLAG,'Y') into l_appr_req_flag
FROM
lns_loan_products_all prod, lns_loan_headers_all loan
WHERE
prod.loan_product_id = loan.product_id
and loan.loan_id = p_loan_id;
SELECT
nvl(sum(pmt_sch.AMOUNT_DUE_REMAINING),0) invoice_balance_amount, nvl(sum(lines.requested_amount),0) requested_amount
FROM
ar_payment_schedules pmt_sch, lns_Loan_Lines lines
WHERE
nvl(lines.installment_number, 1) = pmt_sch.terms_sequence_number
and pmt_sch.customer_trx_id = lines.reference_id
and lines.loan_Id = p_loan_id
and lines.end_date is null
and lines.reference_type = 'RECEIVABLE';