The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT SUM(DECODE(acrh.status, 'REVERSED',(acrh.amount*NVL(acrh.exchange_rate,1))*-1,
NVL(acrh.amount, 0)*NVL(acrh.exchange_rate,1))) INTO amt
FROM ar_cash_receipt_history_all acrh,
ar_cash_receipts_all acr,
hz_cust_accounts rc,
ce_bank_accounts ceba
WHERE acrh.cash_receipt_id = acr.cash_receipt_id
AND acr.remittance_bank_account_id = ceba.bank_account_id
AND acr.pay_from_customer = rc.cust_account_id (+)
AND acrh.status IN (lv_status_cleared, lv_status_remitted, lv_status_confirmed, lv_status_reversed) --'CLEARED', 'REMITTED', 'CONFIRMED','REVERSED') --reversal entries considered
AND ceba.bank_account_name = NVL(b_bank_account_name, ceba.bank_account_name)
AND ceba.bank_account_num = NVL(b_bank_account_num, ceba.bank_account_num)
AND TRUNC(acrh.gl_date ) < TRUNC(b_start_date)
AND (acr.org_id = b_org_id OR acr.org_id IS NULL);
SELECT SUM(accounted_dr) INTO amt1
FROM gl_je_headers glh,
gl_je_lines gll,
ce_gl_accounts_ccid cega,
ce_bank_acct_uses_all cebau,
ce_bank_accounts ceba
WHERE cega.bank_acct_use_id = cebau.bank_acct_use_id
AND cebau.bank_account_id = ceba.bank_account_id
AND ceba.ap_use_allowed_flag = 'Y'
AND (ceba.start_date IS NULL OR ceba.start_date <= trunc(sysdate))
AND (ceba.end_date IS NULL OR ceba.end_date >= trunc(sysdate))
AND cebau.ap_use_enable_flag = 'Y'
AND (cebau.end_date IS NULL OR cebau.end_date >= trunc(sysdate))
AND glh.je_header_id = gll.je_header_id
AND cega.ap_asset_ccid = gll.code_combination_id
AND ceba.bank_account_name = NVL(b_bank_account_name, ceba.bank_account_name)
AND ceba.bank_account_num = NVL(b_bank_account_num, ceba.bank_account_num)
AND glh.je_source NOT IN (lv_src_payables, lv_src_rcv) --'Payables India', 'Receivables India')
AND TRUNC(glh.default_effective_date ) < TRUNC(b_start_date)
AND (cebau.org_id = b_org_id OR cebau.org_id IS NULL);
SELECT SUM(NVL(aip.amount, 0)*NVL(aip.exchange_rate,1)) INTO amt /* Modified by Ramananda for removal of SQL LITERALs :bug#4428980*/
FROM ap_invoice_payments_all aip,
ap_invoices_all api,
ap_checks_all apc,
ce_bank_accounts ceba
WHERE api.invoice_id = aip.invoice_id
AND aip.check_id = apc.check_id
AND apc.bank_account_id = ceba.bank_account_id
AND apc.status_lookup_code IN (lv_negotiable, lv_cleared, lv_voided) --'NEGOTIABLE', 'CLEARED','VOIDED') --added for voided payments by sridhar k
AND ceba.bank_account_name = NVL(b_bank_account_name, ceba.bank_account_name)
AND ceba.bank_account_num = NVL(b_bank_account_num, ceba.bank_account_num)
AND TRUNC(aip.accounting_date ) < TRUNC(b_start_date)
AND (api.org_id = b_org_id OR api.org_id IS NULL);
SELECT SUM(accounted_cr) INTO amt1
FROM gl_je_headers glh,
gl_je_lines gll,
ce_gl_accounts_ccid cega,
ce_bank_acct_uses_all cebau,
ce_bank_accounts ceba
WHERE cega.bank_acct_use_id = cebau.bank_acct_use_id
AND cebau.bank_account_id = ceba.bank_account_id
AND ceba.ap_use_allowed_flag = 'Y'
AND (ceba.start_date IS NULL OR ceba.start_date <= TRUNC (sysdate))
AND (ceba.end_date IS NULL OR ceba.end_date >= trunc(sysdate))
AND cebau.ap_use_enable_flag = 'Y'
AND (cebau.end_date IS NULL OR cebau.end_date >= trunc(sysdate))
AND glh.je_header_id = gll.je_header_id
AND cega.ap_asset_ccid = gll.code_combination_id
AND ceba.bank_account_name = NVL(b_bank_account_name, ceba.bank_account_name)
AND ceba.bank_account_num = NVL(b_bank_account_num, ceba.bank_account_num)
AND glh.je_source NOT IN (lv_src_payables, lv_src_rcv) --'Payables India', 'Receivables India')
AND TRUNC(glh.default_effective_date ) < TRUNC(b_start_date)
AND (cebau.org_id = b_org_id OR cebau.org_id IS NULL);