The following lines contain the word 'select', 'insert', 'update' or 'delete':
select nvl(SUM(d.amount),0)
into P_Result
from AP_INVOICES i,
AP_INVOICE_DISTRIBUTIONS d
where i.invoice_id = d.invoice_id
and i.invoice_type_lookup_code = 'EXPENSE REPORT'
and d.accounting_date >= P_Start_Date
and d.accounting_date <= P_End_Date;
select SUM(P.amount)
into P_Result
from AP_INVOICE_PAYMENTS p,
AP_INVOICES i
where p.invoice_id = i.invoice_id
and p.set_of_books_id = P_Set_Of_Books_ID
and i.invoice_type_lookup_code = 'EXPENSE REPORT'
and p.accounting_date >= P_Start_Date
and p.accounting_date <= P_End_Date;
select COUNT(p.invoice_payment_id)
into P_Result
from AP_INVOICE_PAYMENTS p,
AP_INVOICES i
where p.invoice_id = i.invoice_id
and p.set_of_books_id = P_Set_Of_Books_ID
and i.invoice_type_lookup_code = 'EXPENSE REPORT'
and p.accounting_date >= P_Start_Date
and p.accounting_date <= P_End_Date;
select AVG(p.amount)
into P_Result
from AP_INVOICE_PAYMENTS p,
AP_INVOICES i
where p.invoice_id = i.invoice_id
and p.set_of_books_id = P_Set_Of_Books_ID
and i.invoice_type_lookup_code = 'EXPENSE REPORT'
and p.accounting_date >= P_Start_Date
and p.accounting_date <= P_End_Date;
select COUNT(DISTINCT(I.invoice_id))
into P_Result
from AP_INVOICES I,
AP_INVOICE_DISTRIBUTIONS D
where I.invoice_id = D.invoice_id
and D.Set_Of_Books_Id = P_Set_Of_Books_Id
and I.invoice_type_lookup_code = 'EXPENSE REPORT'
and I.source in ('XpenseXpress', 'Manual Invoice Entry')
and D.accounting_date >= P_Start_Date
and D.accounting_date <= P_End_Date;
select COUNT(DISTINCT(I.invoice_id))
into P_Result
from AP_INVOICES I,
AP_INVOICE_DISTRIBUTIONS D
where I.invoice_id = D.invoice_id
and I.source = 'Oracle Project Accounting'
and D.set_of_books_id = P_Set_Of_Books_Id
and D.accounting_date >= P_Start_Date
and D.accounting_date <= P_End_Date;
select COUNT(DISTINCT(I.invoice_id))
into P_Result
from AP_INVOICES I,
AP_INVOICE_DISTRIBUTIONS D
where I.invoice_id = D.invoice_id
and D.Set_Of_Books_Id = P_Set_Of_Books_Id
and I.source = 'SelfService'
and D.accounting_date >= P_Start_Date
and D.accounting_date <= P_End_Date;