The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT
DISTINCT fthv.transaction_type_code
,fthv.transaction_type
FROM
fa_transaction_history_trx_v fthv
, fa_distribution_history fdh
, gl_code_combinations expense_cc
, fa_book_controls_sec fbc
, fa_deprn_periods fdp
WHERE
fthv.book_type_code = fbc.book_type_code
AND fbc.book_class IN('CORPORATE', 'TAX')
AND fbc.gl_posting_allowed_flag = 'YES'
AND fbc.set_of_books_id = pn_ledger_id
AND
((SELECT greatest(greatest(dp.calendar_period_open_date,
least(sysdate, dp.calendar_period_close_date)),
dp.calendar_period_open_date)
FROM fa_deprn_periods dp
WHERE fthv.book_type_code = dp.book_type_code
AND fthv.date_effective BETWEEN dp.period_open_date AND
nvl(dp.period_close_date, SYSDATE)) BETWEEN ld_start_date AND ld_end_date)
AND fthv.asset_id = fdh.asset_id
AND fdp.book_type_code = fthv.book_type_code
-- Check legal entity
AND fdh.date_effective < nvl(fdp.period_close_date, SYSDATE)
AND (fdh.date_ineffective > fdp.period_open_date
OR fdh.date_ineffective IS NULL)
AND EXISTS
(SELECT jclllbg.bal_seg_value
FROM ja_cn_ledger_le_bsv_gt jclllbg
WHERE JA_CN_CFS_DATA_CLT_PKG.get_balancing_segment(fdh.code_combination_id) =
jclllbg.bal_seg_value
AND jclllbg.Ledger_Id = pn_ledger_id
AND jclllbg.Legal_Entity_Id = pn_legal_entity_id)
AND greatest(greatest(fdp.calendar_period_open_date,
least(SYSDATE, fdp.calendar_period_close_date)))
BETWEEN ld_start_date
AND ld_end_date
AND
fthv.transaction_type_code NOT IN
('ADDITION/VOID', 'TRANSFER IN/VOID', 'TRANSFER IN', 'TRANSFER OUT');
SELECT start_date
INTO ld_start_date
FROM gl_period_statuses
WHERE ledger_id = pn_ledger_id
AND application_id = 101
AND period_name = pv_period_from
AND to_char(period_year) = pv_accounting_year;
SELECT end_date
INTO ld_end_date
FROM gl_period_statuses
WHERE ledger_id = pn_ledger_id
AND application_id = 101
AND period_name = pv_period_to
AND to_char(period_year) = pv_accounting_year;