The following lines contain the word 'select', 'insert', 'update' or 'delete':
select deprn_method_code,
life_in_months
into l_deprn_method_code,
l_life_in_months
from fa_books
where book_type_code = px_asset_hdr_rec.book_type_code
and asset_id = px_asset_hdr_rec.asset_id
and transaction_header_id_out is null;
select fa_transaction_headers_s.nextval
into px_trans_rec.transaction_header_id
from dual;
l_asset_fin_mrc_tbl_adj.delete;
select fa_transaction_headers_s.nextval
into l_trans_rec.transaction_header_id
from dual;
select dest_amortization_start_date
from fa_trx_references
where member_asset_id = p_asset_id
and book_type_code = p_book_type_code
order by dest_amortization_start_date desc;
select transaction_date_entered
from fa_transaction_headers
where asset_id = p_asset_id
and book_type_code = p_book_type_code
and transaction_type_code in
('PARTIAL RETIREMENT','REINSTATEMENT'
)
order by transaction_date_entered desc;
select bk_old.deprn_method_code,
bk_old.life_in_months,
bk_old.basic_rate,
bk_old.adjusted_rate,
bk_old.allowed_deprn_limit,
bk_old.deprn_limit_type,
bk_old.allowed_deprn_limit_amount
from fa_books bk_old, fa_books bk_extnd
where bk_old.book_type_code = p_book_type_code and
bk_old.asset_id = p_asset_id and
bk_old.extended_depreciation_period is null and
bk_extnd.book_type_code = p_book_type_code and
bk_extnd.asset_id = p_asset_id and
bk_extnd.extended_depreciation_period is not null and
bk_extnd.transaction_header_id_in = bk_old.transaction_header_id_out
order by bk_extnd.transaction_header_id_in desc;
select greatest(calendar_period_open_date,
least(sysdate, calendar_period_close_date))
from fa_deprn_periods
where book_type_code = c_book_type_code
and period_close_date is null;
select rate_source_rule,rule_name
from fa_methods mt,fa_deprn_basis_rules dbr
where mt.method_code = c_method_code
and mt.deprn_basis_rule_id = dbr.deprn_basis_rule_id(+);
select cp.start_date,
cp.end_date
into l_extend_calendar_pod,
l_extend_calendar_pcd
from fa_book_controls bc,
fa_fiscal_year fy,
fa_calendar_types ct,
fa_calendar_periods cp
where bc.book_type_code = px_asset_hdr_rec.book_type_code and
bc.deprn_calendar = ct.calendar_type and
cp.calendar_type = ct.calendar_type and
bc.fiscal_year_name = ct.fiscal_year_name and
fy.fiscal_year_name = ct.fiscal_year_name and
cp.period_num = 1 and
fy.fiscal_year = round (
(l_asset_fin_rec_adj.extended_depreciation_period - cp.period_num)/
ct.number_per_fiscal_year) and
cp.start_date = fy.start_date;
adj_row.selection_mode := fa_std_types.FA_AJ_ACTIVE;
adj_row.last_update_date := sysdate;
select sum(decode(debit_credit_flag,'DR',adjustment_amount,-1*adjustment_amount))
into l_expense_amount
from fa_adjustments_mrc_v
where asset_id = px_asset_hdr_rec.asset_id
and book_type_code = px_asset_hdr_rec.book_type_code
and source_type_code = 'DEPRECIATION'
and adjustment_type = 'EXPENSE';
delete from fa_adjustments_mrc_v
where asset_id = px_asset_hdr_rec.asset_id
and book_type_code = px_asset_hdr_rec.book_type_code
and source_type_code = 'DEPRECIATION'
and adjustment_type = 'EXPENSE';
select sum(decode(debit_credit_flag,'DR',adjustment_amount,-1*adjustment_amount))
into l_expense_amount
from fa_adjustments
where asset_id = px_asset_hdr_rec.asset_id
and book_type_code = px_asset_hdr_rec.book_type_code
and source_type_code = 'DEPRECIATION'
and adjustment_type = 'EXPENSE';
delete from fa_adjustments
where asset_id = px_asset_hdr_rec.asset_id
and book_type_code = px_asset_hdr_rec.book_type_code
and source_type_code = 'DEPRECIATION'
and adjustment_type = 'EXPENSE';
select fa_trx_references_s.nextval
into px_trans_rec.trx_reference_id
from dual;
MC_FA_UTILITIES_PKG.insert_books_rates
(p_set_of_books_id => l_asset_hdr_rec.set_of_books_id,
p_asset_id => l_asset_hdr_rec.asset_id,
p_book_type_code => l_asset_hdr_rec.book_type_code,
p_transaction_header_id => px_trans_rec.transaction_header_id,
p_invoice_transaction_id => px_inv_trans_rec.invoice_transaction_id,
p_exchange_date => px_trans_rec.transaction_date_entered,
p_cost => l_asset_fin_rec_adj_init.cost,
p_exchange_rate => l_exchange_rate,
p_avg_exchange_rate => l_avg_rate,
p_last_updated_by => px_trans_rec.who_info.last_updated_by,
p_last_update_date => px_trans_rec.who_info.last_update_date,
p_last_update_login => px_trans_rec.who_info.last_update_login,
p_complete => 'Y',
p_trigger => 'adj api',
p_currency_code => l_asset_hdr_rec.set_of_books_id,
p_log_level_rec => p_log_level_rec);
select fa_transaction_headers_s.nextval
into l_src_trans_rec.transaction_header_id
from dual;
UPDATE FA_DEPRN_OVERRIDE
SET status = 'POSTED'
WHERE used_by = 'ADJUSTMENT'
AND status = 'SELECTED';