The following lines contain the word 'select', 'insert', 'update' or 'delete':
fp_reval_input_asset.last_update_login := 0;
fp_reval_input_asset.last_update_date := null;
fp_reval_input_asset.last_updated_by := 0;
fp_reval_asset_rules.selected_for_reval_flag := null;
fp_reval_asset_rules.selected_for_calc_flag := null;
fp_reval_asset_rules.last_update_login := 0;
fp_reval_asset_rules.last_update_date := null;
fp_reval_asset_rules.last_updated_by := 0;
fp_reval_asset_rules.allow_prof_update := null;
fp_Reval_Rates.last_update_login := 0;
fp_Reval_Rates.last_update_date := null;
fp_Reval_Rates.last_updated_by := 0;
/* update or populate the reval_control record */
l_reval_params.reval_control.revaluation_mode := fp_revaluation_mode;
select dd.*
into l_reval_params.reval_asset_rules
from igi_iac_reval_asset_rules dd
where dd.asset_id = fp_asset_id
and dd.book_type_code = fp_book_type_code
and dd.revaluation_id = fp_revaluation_id
;
select h.revaluation_date
into l_reval_params.reval_asset_params.revaluation_date
from igi_iac_revaluations h
where h.revaluation_id = fp_revaluation_id
;
select nvl(max(period_counter),0)
into l_max_period_counter
from igi_iac_asset_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter <= fp_period_counter
;
l_reval_params.reval_input_asset.last_update_login := g_who_login_id ;
l_reval_params.reval_input_asset.last_update_date := g_who_date ;
l_reval_params.reval_input_asset.last_updated_by := g_who_user_id;
select *
into l_reval_params.reval_input_asset
from igi_iac_asset_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter = l_max_period_counter
;
select *
into l_reval_params.reval_prev_rate_info
from igi_iac_revaluation_rates
where asset_id = fp_asset_id
and period_counter <= fp_period_counter
and book_type_code = fp_book_type_code
and reval_type in ( 'O','P')
and nvl(latest_record,'X') = 'Y'
;
l_reval_params.reval_prev_rate_info.last_update_login := g_who_login_id;
l_reval_params.reval_prev_rate_info.last_update_date := g_who_date;
l_reval_params.reval_prev_rate_info.last_updated_by := g_who_user_id;
select fb.cost
, fb.adjusted_cost
, fb.original_cost
, fb.salvage_value
, fb.life_in_months
, fb.rate_adjustment_factor
, fb.period_counter_fully_reserved
, fb.adjusted_recoverable_cost
, fb.recoverable_cost
, fb.date_placed_in_service
, fb.deprn_start_date
, fb.depreciate_flag
, fbc.last_period_counter
, fbc.gl_posting_allowed_flag
, fds.ytd_deprn
, fds.deprn_reserve
, fds.deprn_amount
, fadd.asset_category_id
from fa_books fb
, fa_book_controls fbc
, fa_deprn_summary fds
, fa_additions fadd
where fb.book_type_code = fbc.book_type_code
and fb.book_type_code = fp_book_type_code
-- and fbc.last_period_counter = fp_period_counter
and fadd.asset_id = fp_asset_id
and fb.asset_id = fp_asset_id
and fb.transaction_header_id_out is null
and fds.book_type_code = fp_book_type_code
and fds.asset_id = fp_asset_id
and fds.period_counter = ( select max(period_counter)
from fa_deprn_summary
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter <= fp_period_counter
)
-- this should fail with asset with deprn = no, need to verify this later on...
;
/* update or populate the reval_control record */
l_reval_params.reval_control.revaluation_mode := fp_revaluation_mode;
select dd.*
into l_reval_params.reval_asset_rules
from igi_iac_reval_asset_rules dd
where dd.asset_id = fp_asset_id
and dd.book_type_code = fp_book_type_code
and dd.revaluation_id = fp_revaluation_id
;
select h.revaluation_date
into l_reval_params.reval_asset_params.revaluation_date
from igi_iac_revaluations h
where h.revaluation_id = fp_revaluation_id
;
select nvl(max(period_counter),0)
into l_max_period_counter
from igi_iac_asset_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter <= fp_period_counter
;
l_reval_params.reval_input_asset.last_update_login := g_who_login_id ;
l_reval_params.reval_input_asset.last_update_date := g_who_date ;
l_reval_params.reval_input_asset.last_updated_by := g_who_user_id;
select *
into l_reval_params.reval_input_asset
from igi_iac_asset_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter = l_max_period_counter
;
l_reval_params.reval_prev_rate_info.last_update_login := g_who_login_id;
l_reval_params.reval_prev_rate_info.last_update_date := g_who_date;
l_reval_params.reval_prev_rate_info.last_updated_by := g_who_user_id;
select fb.cost
, fb.adjusted_cost
, fb.original_cost
, fb.salvage_value
, fb.life_in_months
, fb.rate_adjustment_factor
, fb.period_counter_fully_reserved
, fb.adjusted_recoverable_cost
, fb.recoverable_cost
, fb.date_placed_in_service
, fb.deprn_start_date
, fb.depreciate_flag
, fbc.last_period_counter
, fbc.gl_posting_allowed_flag
, fds.ytd_deprn
, fds.deprn_reserve
, fds.deprn_amount
, fadd.asset_category_id
from fa_books fb
, fa_book_controls fbc
, fa_deprn_summary fds
, fa_additions fadd
where fb.book_type_code = fbc.book_type_code
and fb.book_type_code = fp_book_type_code
and fadd.asset_id = fp_asset_id
and fb.asset_id = fp_asset_id
and fb.transaction_header_id_out is null
and fds.book_type_code = fp_book_type_code
and fds.asset_id = fp_asset_id
and fds.period_counter = ( select max(period_counter)
from fa_deprn_summary
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter <= fp_period_counter
)
-- this should fail with asset with deprn = no, need to verify this later on...
;