The following lines contain the word 'select', 'insert', 'update' or 'delete':
select count(1)
into l_num_periods
from gl_periods gp, gl_sets_of_books sob
where 1 = 1
and sob.set_of_books_id = p_sob_id
and gp.period_set_name = sob.period_set_name
and gp.period_type = sob.accounted_period_type
and trunc(gp.end_date) >= p_start_date
and trunc(gp.start_date) <= p_end_date
and gp.adjustment_period_flag = 'N';
select order_number
into l_order_number
from okx_order_headers_v oh,
okc_k_rel_objs_v ro
where ro.chr_id = p_chr_id
and ro.cle_id is null
and ro.object1_id1 = oh.id1;
select trunc(gp.start_date), trunc(gp.end_date)
into l_period_start_date, l_period_end_date
from gl_periods gp, gl_sets_of_books sob
where 1 = 1
and sob.set_of_books_id = p_sob_id
and gp.period_set_name = sob.period_set_name
and gp.period_type = sob.accounted_period_type
and p_end_date between gp.start_date and gp.end_date
and gp.adjustment_period_flag = 'N';
/* Select current month revenue */
select
SUM(
cpl.price_negotiated
* months_between(
trunc(least(l_period_end_date,cpl.end_date))+0.99999,
trunc(greatest(l_period_start_date,cpl.start_date))
)
/ months_between(trunc(cpl.end_date)+0.99999,trunc(cpl.start_date))
)
into l_cur_month_rev
from oki_cov_prd_lines cpl
where 1 = 1
and cpl.chr_id = p_chr_id
and cpl.start_date <= l_period_end_date+0.99999
and cpl.end_date >= l_period_start_date
and cpl.ste_code = 'ENTERED';
select trunc(gp.start_date), trunc(gp.end_date)
into l_period_start_date, l_period_end_date
from gl_periods gp, gl_sets_of_books sob
where 1 = 1
and sob.set_of_books_id = p_sob_id
and gp.period_set_name = sob.period_set_name
and gp.period_type = sob.accounted_period_type
and p_end_date between gp.start_date and gp.end_date
and gp.adjustment_period_flag = 'N';
/* Select back dated revenue */
select
SUM(
cpl.price_negotiated
*months_between(
trunc(least(l_period_start_date,cpl.end_date))+0.99999,
trunc(cpl.start_date)
)
/ months_between(trunc(cpl.end_date)+0.99999,trunc(cpl.start_date))
)
into l_backdated_rev
from oki_cov_prd_lines cpl
where 1 = 1
and cpl.chr_id = p_chr_id
and cpl.start_date < l_period_start_date
and cpl.ste_code = 'ENTERED';