The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT nvl(aspa.interest_tolerance_amount,0)
INTO P_interest_tolerance_amount
FROM ap_system_parameters_all aspa,
ap_invoices_all aia
WHERE aia.invoice_id = x_invoice_id
AND aia.set_of_books_id = aspa.set_of_books_id
AND aia.org_id = nvl(aspa.org_id, aia.org_id)
AND rownum < 2;
SELECT (nvl(x_amount_remaining -
least(nvl(x_discount_taken, 0), x_discount_available), 0) *
power(1 + (annual_interest_rate / (12 * 100)),
trunc((least(x_check_date, due_date + 360)
-due_date) / 30)) *
(1 + ((annual_interest_rate / (360 * 100)) *
mod((least(x_check_date,due_date + 360)
-due_date), 30)))) -
nvl(x_amount_remaining - least(nvl(x_discount_taken, 0),
x_discount_available), 0)
INTO C_interest_amount
FROM ap_payment_schedules_all, ap_interest_periods
WHERE x_sys_auto_flg = 'Y'
AND x_auto_calc_int_flg = 'Y'
AND trunc(x_check_date) > trunc(due_date)
AND payment_num = x_payment_num
AND invoice_id = x_invoice_id
AND trunc(due_date+1) BETWEEN trunc(start_date) AND trunc(end_date)
AND (nvl(x_amount_remaining -
least(nvl(x_discount_taken, 0), x_discount_available), 0) *
power(1 + (annual_interest_rate / (12 * 100)),
trunc((least(x_check_date, due_date + 360)
-due_date) / 30)) *
(1 + ((annual_interest_rate / (360 * 100)) *
mod((least(x_check_date, due_date + 360)
-due_date), 30)))) -
nvl(x_amount_remaining - least(nvl(x_discount_taken, 0),
x_discount_available), 0)
>= P_interest_tolerance_amount;
Select invoice_currency_code
into l_code
from ap_invoices_all
where invoice_id =x_invoice_id;
select precision
into l_precision
from fnd_currencies
where currency_code =l_code;