The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT /*+ ORDERED index ( RET FA_RETIREMENTS_N3 ) index( FAB FA_BOOKS_N5 ) use_nl ( RET FAB ) */
RET.RETIREMENT_ID
,RET.ASSET_ID
,FAA.ASSET_NUMBER
FROM FA_RETIREMENTS RET,
FA_BOOKS FAB,
FA_METHODS M,
FA_ADDITIONS_B FAA
WHERE RET.BOOK_TYPE_CODE = p_book_type_code
AND RET.STATUS in ('PENDING', 'REINSTATE', 'PARTIAL')
AND M.METHOD_CODE(+) = RET.STL_METHOD_CODE
AND M.LIFE_IN_MONTHS(+) = RET.STL_LIFE_IN_MONTHS
AND FAB.RETIREMENT_ID= RET.RETIREMENT_ID
AND FAB.BOOK_TYPE_CODE= RET.BOOK_TYPE_CODE
AND FAB.ASSET_ID= RET.ASSET_ID
AND RET.RETIREMENT_ID > px_max_retirement_id
AND MOD(nvl(FAB.GROUP_ASSET_ID,RET.RETIREMENT_ID), p_total_requests) = (p_request_number - 1)
AND FAA.ASSET_ID = FAB.ASSET_ID
ORDER BY RET.RETIREMENT_ID;
select count(*)
into l_count
from fa_deprn_summary
where book_type_code = l_asset_hdr_rec.book_type_code
and asset_id = l_asset_hdr_rec.asset_id
and period_counter = l_period_rec.period_counter;
select transaction_type_code
into l_trx_type_code
from fa_transaction_headers
where transaction_header_id=
(select transaction_header_id_in
from fa_retirements
where retirement_id=p_retirement_id);
select date_effective
into ret.date_effective
from fa_retirements
where retirement_id = l_asset_retire_rec.retirement_id;
select date_effective
into ret.date_effective
from fa_mc_retirements
where retirement_id = lv_asset_retire_rec.retirement_id
and set_of_books_id = l_sob_tbl(l_sob_index);
select asset_type
into l_asset_type
from fa_additions_b
where asset_id = l_asset_hdr_rec.asset_id;
element => 'setting up parameters for event update, ret_status',
value => l_asset_retire_rec.status,
p_log_level_rec => p_log_level_rec);
select transaction_header_id_out
into l_thid
from fa_retirements
where retirement_id = l_asset_retire_rec.retirement_id;
select event_id,
transaction_date_entered
into l_event_id,
L_trx_date_entered
from fa_transaction_headers
where transaction_header_id = l_thid;
update fa_transaction_headers
set event_id = l_trans_rec.event_id
where transaction_header_id = l_thid;
element => 'calling fa_xla_events_pvt.update_transaction_event with thid: ',
value => l_thid);
if not fa_xla_events_pvt.update_transaction_event
(p_ledger_id => l_primary_sob_id,
p_transaction_header_id => l_thid,
p_book_type_code => l_asset_hdr_rec.book_type_code,
p_event_type_code => l_event_type_code,
p_event_date => greatest(l_trx_date_entered,
l_period_rec.calendar_period_open_date),
p_event_status_code => FA_XLA_EVENTS_PVT.C_EVENT_UNPROCESSED,
p_calling_fn => l_calling_fn,
p_log_level_rec => p_log_level_rec) then
raise gainloss_err;
update event for secondary ledger*/
l_secondary_sob_id := FA_XLA_EVENTS_PVT.get_secondary_sob_id(l_asset_hdr_rec.book_type_code);
if p_log_level_rec.statement_level then fa_debug_pkg.add (fname => l_calling_fn,element => 'before secondary update l_secondary_sob_id ',value => l_secondary_sob_id); end if;
if p_log_level_rec.statement_level then fa_debug_pkg.add (fname => l_calling_fn,element => 'before secondary update l_primary_sob_id ',value => l_primary_sob_id); end if;
if not fa_xla_events_pvt.update_transaction_event
(p_ledger_id => l_secondary_sob_id,
p_transaction_header_id => l_thid,
p_book_type_code => l_asset_hdr_rec.book_type_code,
p_event_type_code => l_event_type_code,
p_event_date => greatest(l_trx_date_entered,
l_period_rec.calendar_period_open_date),
p_event_status_code => FA_XLA_EVENTS_PVT.C_EVENT_UNPROCESSED,
p_secondary_flag => TRUE,
p_secondary_sob_id => l_secondary_sob_id,
p_calling_fn => l_calling_fn,
p_log_level_rec => p_log_level_rec) then
raise gainloss_err;