The following lines contain the word 'select', 'insert', 'update' or 'delete':
select cumulative_reval_factor, current_reval_factor
from igi_iac_asset_balances
where asset_id = cp_asset_id
and book_type_code = cp_book_type_code
and period_counter = cp_period_counter
;
delete from igi_iac_exceptions
where asset_id = fp_reval_exceptions.asset_id
and book_type_code = fp_reval_exceptions.book_type_code
and revaluation_id = fp_revaluation_id;
select asset_category_id
into l_category_id
from fa_additions
where asset_id = fp_reval_exceptions.asset_id;
insert into igi_iac_exceptions
(
revaluation_id ,
asset_id ,
category_id ,
book_type_code ,
exception_message ,
created_by ,
creation_date ,
last_update_login ,
last_update_date ,
last_updated_by )
values
(
fp_revaluation_id
, fp_reval_exceptions.asset_id
, l_category_id
, fp_reval_exceptions.book_type_code
, fp_reval_exceptions.reason
, l_user_id
, sysdate
, l_login_id
, sysdate
, l_user_id
) ;
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'Inserted into exceptions');
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'No records to insert');
select adjustment_id
into l_max_adjustment_id
from igi_iac_transaction_headers
where adjustment_id_out is null
and book_type_code = fp_reval_params.reval_asset_params.book_type_code
and asset_id = fp_reval_params.reval_asset_params.asset_id
;
IGI_IAC_TRANS_HEADERS_PKG.insert_row (
x_rowid => l_rowid ,
x_adjustment_id => l_adjustment_id,
x_transaction_header_id => NULL,
x_adjustment_id_out => null,
x_transaction_type_code => fp_reval_params.reval_control.transaction_type_code,
x_transaction_date_entered => sysdate,
x_mass_refrence_id => fp_reval_params.reval_asset_params.revaluation_id,
x_transaction_sub_type => fp_reval_params.reval_control.transaction_sub_type,
x_book_type_code => fp_reval_params.reval_asset_params.book_type_code,
x_asset_id => fp_reval_params.reval_asset_params.asset_id,
x_category_id => fp_reval_params.reval_asset_params.category_id,
x_adj_deprn_start_date => fp_reval_params.fa_asset_info.deprn_start_date,
x_revaluation_type_flag => l_reval_type_flag ,
x_adjustment_status => fp_reval_params.reval_control.adjustment_status,
x_period_counter => fp_reval_params.reval_asset_params.period_counter,
x_mode => 'R',
x_event_id => Null
);
IGI_IAC_TRANS_HEADERS_PKG.update_row (
x_prev_adjustment_id => l_max_adjustment_id,
x_adjustment_id => l_adjustment_id,
x_mode => 'R'
);
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+balance record already exists, so update');
IGI_IAC_ASSET_BALANCES_PKG.update_row (
x_asset_id => pp_reval_output_asset.asset_id,
x_book_type_code => pp_reval_output_asset.book_type_code,
x_period_counter => pp_period_counter,
x_net_book_value => pp_reval_output_asset.net_book_value,
x_adjusted_cost => pp_reval_output_asset.adjusted_cost,
x_operating_acct => pp_reval_output_asset.operating_acct,
x_reval_reserve => pp_reval_output_asset.reval_reserve,
x_deprn_amount => pp_reval_output_asset.deprn_amount,
x_deprn_reserve => pp_reval_output_asset.deprn_reserve,
x_backlog_deprn_reserve => pp_reval_output_asset.backlog_deprn_reserve,
x_general_fund => pp_reval_output_asset.general_fund,
x_last_reval_date => pp_reval_output_asset.last_reval_date,
x_current_reval_factor => pp_reval_output_asset.current_reval_factor,
x_cumulative_reval_factor => pp_reval_output_asset.cumulative_reval_factor,
x_mode => 'R'
);
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+balance record does not exist, so insert');
IGI_IAC_ASSET_BALANCES_PKG.insert_row (
x_rowid => l_rowid,
x_asset_id => pp_reval_output_asset.asset_id,
x_book_type_code => pp_reval_output_asset.book_type_code,
x_period_counter => pp_period_counter,
x_net_book_value => pp_reval_output_asset.net_book_value,
x_adjusted_cost => pp_reval_output_asset.adjusted_cost,
x_operating_acct => pp_reval_output_asset.operating_acct,
x_reval_reserve => pp_reval_output_asset.reval_reserve,
x_deprn_amount => pp_reval_output_asset.deprn_amount,
x_deprn_reserve => pp_reval_output_asset.deprn_reserve,
x_backlog_deprn_reserve => pp_reval_output_asset.backlog_deprn_reserve,
x_general_fund => pp_reval_output_asset.general_fund,
x_last_reval_date => pp_reval_output_asset.last_reval_date,
x_current_reval_factor => pp_reval_output_asset.current_reval_factor,
x_cumulative_reval_factor => pp_reval_output_asset.cumulative_reval_factor,
x_mode => 'R'
);
select *
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
;
select bal.*
from igi_iac_det_balances bal
where bal.adjustment_id = fp_adjustment_id
and bal.distribution_id = fp_distribution_id
and bal.asset_id = fp_asset_id
and bal.period_counter <= period_counter
and bal.book_type_code = fp_book_type_code
;
SELECT 1
FROM dual
WHERE EXISTS(
SELECT 1
FROM igi_iac_transaction_headers th, igi_iac_det_balances db
WHERE th.transaction_sub_type = 'IMPLEMENTATION'
AND th.adjustment_id = db.adjustment_id
AND db.book_type_code = p_book_type_code
AND db.period_counter = p_period_counter
AND db.book_type_code = th.book_type_code
AND db.asset_id = th.asset_id
AND db.asset_id = p_asset_id)
;
select distinct 'x'
from igi_iac_det_Balances
where asset_id = p_asset_id
and distribution_id = p_distribution_id
and book_type_code = p_book_type_code
;
select TRANSACTION_SUB_TYPE
into transaction_sub_type
from igi_iac_transaction_headers
where ADJUSTMENT_ID = fp_adjustment_id;
IGI_IAC_DET_BALANCES_PKG.insert_row (
x_rowid => l_rowid,
x_adjustment_id => l_det_balances.adjustment_id,
x_asset_id => l_det_balances.asset_id,
x_distribution_id => l_det_balances.distribution_id,
x_book_type_code => l_det_balances.book_type_code,
x_period_counter => l_det_balances.period_counter,
x_adjustment_cost => l_det_balances.adjustment_cost,
x_net_book_value => l_det_balances.net_book_value,
x_reval_reserve_cost => l_det_balances.reval_reserve_cost,
x_reval_reserve_backlog => l_det_balances.reval_reserve_backlog,
x_reval_reserve_gen_fund => l_det_balances.reval_reserve_gen_fund,
x_reval_reserve_net => l_det_balances.reval_reserve_net,
x_operating_acct_cost => l_det_balances.operating_acct_cost,
x_operating_acct_backlog => l_det_balances.operating_acct_backlog,
x_operating_acct_net => l_det_balances.operating_acct_net,
x_operating_acct_ytd => 0, -- l_det_balances.operating_acct_ytd,
x_deprn_period => l_det_balances.deprn_period,
x_deprn_ytd => l_det_balances.deprn_ytd,
x_deprn_reserve => l_det_balances.deprn_reserve,
x_deprn_reserve_backlog => l_det_balances.deprn_reserve_backlog,
x_general_fund_per => l_det_balances.general_fund_per,
x_general_fund_acc => l_det_balances.general_fund_acc,
x_last_reval_date => l_det_balances.last_reval_date,
x_current_reval_factor => l_det_balances.current_reval_factor,
x_cumulative_reval_factor => l_det_balances.cumulative_reval_factor,
x_active_flag => l_det_balances.active_flag,
x_mode => 'R' );
IGI_IAC_FA_DEPRN_PKG.insert_row (
x_rowid => l_rowid,
x_adjustment_id => l_det_balances.adjustment_id,
x_asset_id => l_det_balances.asset_id,
x_distribution_id => l_det_balances.distribution_id,
x_book_type_code => l_det_balances.book_type_code,
x_period_counter => l_det_balances.period_counter,
x_deprn_period => l_fa_balances.deprn_amount,
x_deprn_ytd => l_fa_balances.ytd_deprn,
x_deprn_reserve => l_fa_balances.deprn_reserve,
x_active_flag => l_det_balances.active_flag,
x_mode => 'R' );
SELECT max(adjustment_id)
FROM igi_iac_transaction_headers
WHERE book_type_code = p_book_type_code
AND asset_id = p_asset_id
AND adjustment_id < p_adjustment_id
AND adjustment_status NOT IN ('PREVIEW','OBSOLETE');
SELECT iidb.adjustment_id,
iidb.distribution_id,
iidb.adjustment_cost,
iidb.net_book_value,
iidb.reval_reserve_cost,
iidb.reval_reserve_backlog,
iidb.reval_reserve_gen_fund,
iidb.reval_reserve_net,
iidb.operating_acct_cost,
iidb.operating_acct_backlog,
iidb.operating_acct_net,
iidb.operating_acct_ytd,
iidb.deprn_period,
iidb.deprn_ytd,
iidb.deprn_reserve,
iidb.deprn_reserve_backlog,
iidb.general_fund_per,
iidb.general_fund_acc,
iidb.active_flag,
iidb.last_reval_date,
iidb.current_reval_factor,
iidb.cumulative_reval_factor
FROM igi_iac_det_balances iidb
WHERE iidb.adjustment_id = cp_adjustment_id
AND iidb.asset_id = p_asset_id
AND iidb.book_type_code = p_book_type_code
AND nvl(iidb.active_flag,'Y') = 'N';
SELECT iifd.distribution_id,
iifd.deprn_period,
iifd.deprn_ytd,
iifd.deprn_reserve,
iifd.active_flag
FROM igi_iac_fa_deprn iifd
WHERE iifd.adjustment_id = cp_adjustment_id
AND iifd.book_type_code = p_book_type_code
AND iifd.asset_id = p_asset_id
AND nvl(iifd.active_flag,'Y') = 'N';
IGI_IAC_DET_BALANCES_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => p_adjustment_id,
x_asset_id => p_asset_id,
x_book_type_code => p_book_type_code,
x_distribution_id => l_iac_inactive_dist.distribution_id,
x_period_counter => p_period_counter,
x_adjustment_cost => l_iac_inactive_dist.adjustment_cost,
x_net_book_value => l_iac_inactive_dist.net_book_value,
x_reval_reserve_cost => l_iac_inactive_dist.reval_reserve_cost,
x_reval_reserve_backlog => l_iac_inactive_dist.reval_reserve_backlog,
x_reval_reserve_gen_fund => l_iac_inactive_dist.reval_reserve_gen_fund,
x_reval_reserve_net => l_iac_inactive_dist.reval_reserve_net,
x_operating_acct_cost => l_iac_inactive_dist.operating_acct_cost,
x_operating_acct_backlog => l_iac_inactive_dist.operating_acct_backlog,
x_operating_acct_net => l_iac_inactive_dist.operating_acct_net,
x_operating_acct_ytd => l_iac_inactive_dist.operating_acct_ytd,
x_deprn_period => l_iac_inactive_dist.deprn_period,
x_deprn_ytd => l_iac_inactive_dist.deprn_ytd,
x_deprn_reserve => l_iac_inactive_dist.deprn_reserve,
x_deprn_reserve_backlog => l_iac_inactive_dist.deprn_reserve_backlog,
x_general_fund_per => l_iac_inactive_dist.general_fund_per,
x_general_fund_acc => l_iac_inactive_dist.general_fund_acc,
x_last_reval_date => l_iac_inactive_dist.last_reval_date,
x_current_reval_factor => l_iac_inactive_dist.current_reval_factor,
x_cumulative_reval_factor => l_iac_inactive_dist.cumulative_reval_factor,
x_active_flag => l_iac_inactive_dist.active_flag,
x_mode => 'R' );
IGI_IAC_FA_DEPRN_PKG.Insert_Row(
x_rowid => l_rowid,
x_book_type_code => p_book_type_code,
x_asset_id => p_asset_id,
x_period_counter => p_period_counter,
x_adjustment_id => p_adjustment_id,
x_distribution_id => l_fa_inactive_dist.distribution_id,
x_deprn_period => l_fa_inactive_dist.deprn_period,
x_deprn_ytd => l_fa_inactive_dist.deprn_ytd,
x_deprn_reserve => l_fa_inactive_dist.deprn_reserve,
x_active_flag => l_fa_inactive_dist.active_flag,
x_mode => 'R' );
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'Inserting into igi_iac_det_balances');
IGI_IAC_DET_BALANCES_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => p_adjustment_id,
x_asset_id => p_asset_id,
x_book_type_code => p_book_type_code,
x_distribution_id => l_YTD_prorate_dists_tab(idx_YTD).distribution_id,
x_period_counter => p_period_counter,
x_adjustment_cost => 0,
x_net_book_value => 0,
x_reval_reserve_cost => 0,
x_reval_reserve_backlog => 0,
x_reval_reserve_gen_fund => 0,
x_reval_reserve_net => 0,
x_operating_acct_cost => 0,
x_operating_acct_backlog => 0,
x_operating_acct_net => 0,
x_operating_acct_ytd => 0,
x_deprn_period => 0,
x_deprn_ytd => l_dist_iac_ytd,
x_deprn_reserve => 0,
x_deprn_reserve_backlog => 0,
x_general_fund_per => 0,
x_general_fund_acc => 0,
x_last_reval_date => null,
x_current_reval_factor => 0,
x_cumulative_reval_factor => 0,
x_active_flag => 'N',
x_mode => 'R' );
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'Inserting into igi_iac_fa_deprn');
IGI_IAC_FA_DEPRN_PKG.Insert_Row(
x_rowid => l_rowid,
x_book_type_code => p_book_type_code,
x_asset_id => p_asset_id,
x_period_counter => p_period_counter,
x_adjustment_id => p_adjustment_id,
x_distribution_id => l_YTD_prorate_dists_tab(idx_YTD).distribution_id,
x_deprn_period => 0,
x_deprn_ytd => l_dist_fa_ytd,
x_deprn_reserve => 0,
x_active_flag => 'N',
x_mode => 'R' );
select (nvl(deprn_amount,0) - nvl(deprn_adjustment_amount,0)) deprn_amount,
deprn_reserve
from fa_deprn_detail
where book_type_code = fp_reval_params.reval_asset_params.book_type_code
and asset_id = fp_reval_params.reval_asset_params.asset_id
and distribution_id = cp_distribution_id
and period_counter = (select max(period_counter)
from fa_deprn_summary
where book_type_code = fp_reval_params.reval_asset_params.book_type_code
and asset_id = fp_reval_params.reval_asset_params.asset_id);
select sum(nvl(fdd.deprn_amount,0)-nvl(fdd.deprn_adjustment_amount,0)) deprn_YTD
from fa_deprn_detail fdd
where fdd.book_type_code = fp_reval_params.reval_asset_params.book_type_code
and fdd.asset_id = fp_reval_params.reval_asset_params.asset_id
and fdd.distribution_id = cp_distribution_id
and fdd.period_counter in (select period_counter from fa_deprn_periods
where book_type_code = fp_reval_params.reval_asset_params.book_type_code
and fiscal_year = (select decode(period_num,1,fiscal_year-1,fiscal_year)
from fa_deprn_periods
where period_close_date is NULL
and book_type_code = fp_reval_params.reval_asset_params.book_type_code))
group by fdd.asset_id,fdd.distribution_id;
select iifd.deprn_period, iifd.deprn_ytd, iifd.deprn_reserve
from igi_iac_fa_deprn iifd
where iifd.asset_id = fp_reval_params.reval_asset_params.asset_id
and iifd.book_type_code = fp_reval_params.reval_asset_params.book_type_code
and iifd.adjustment_id = cp_adjustment_id
and iifd.distribution_id = cp_distribution_id;
select nvl(max(adjustment_id),-1)
into l_prev_adj_id
from igi_iac_transaction_headers
where asset_id = fp_reval_params.reval_asset_params.asset_id
and book_type_code = fp_reval_params.reval_asset_params.book_type_code
and adjustment_status in ( 'RUN','COMPLETE')
and adjustment_id < l_adjustment_id
;
select nvl(operating_acct_ytd,0)
into l_operatg_ytd_bal
from igi_iac_det_balances
where asset_id = fp_reval_params.reval_asset_params.asset_id
and distribution_id = l_prorate_dists_tab( idx ).distribution_id
and book_type_code = fp_reval_params.reval_asset_params.book_type_code
and adjustment_id = l_prev_adj_id
and l_prev_adj_id <> -1
;
/* verify the net figures prior to inserting */
verify_det_balances ( fp_det_balances => l_prev_db
, fp_prev_cum_factor => l_prev_factor_cumm
, fp_curr_cum_factor => l_reval_factor_cumm
);
/* now prev db is updated with the current movemnt, so create new record */
if ( not create_det_balances_private ( fp_det_balances => l_prev_db ) )
then
igi_iac_debug_pkg.debug_other_string(g_error_level,l_path,'error in table handler for det balances');
insert into igi_iac_revaluation_Rates
(
asset_id
,book_type_code
,revaluation_id
,period_counter
,reval_type
,current_reval_factor
,cumulative_reval_factor
,processed_flag
,adjustment_id
,latest_record
,created_by
,creation_date
,last_update_login
,last_update_date
,last_updated_by
)
values
(
l_reval_rates.asset_id
,l_reval_rates.book_type_code
,l_reval_rates.revaluation_id
,l_reval_rates.period_counter
,l_reval_rates.reval_type
,l_reval_rates.current_reval_factor
,l_reval_rates.cumulative_reval_factor
,l_reval_rates.processed_flag
,l_adjustment_id
,l_reval_rates.latest_record
,l_reval_rates.created_by
,l_reval_rates.creation_date
,l_reval_rates.last_update_login
,l_reval_rates.last_update_date
,l_reval_rates.last_updated_by
);
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+inserted previous set reval rates');
igi_iac_debug_pkg.debug_other_string(g_error_level,l_path,'+failed insert of reval rates');
function update_reval_rates ( fp_adjustment_id in number )
return boolean is
cursor c_txns is
select asset_id, book_type_code
from igi_iac_transaction_headers
where adjustment_id = fp_adjustment_id
;
l_path := g_path||'update_reval_rates';
update igi_iac_revaluation_rates
set latest_record = 'N'
where asset_id = l_txns.asset_id
and book_type_code = l_txns.book_type_code
and processed_flag = 'Y'
and adjustment_id <> fp_adjustment_id
;
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+ updated previous set reval rates');
igi_iac_debug_pkg.debug_other_string(g_error_level,l_path,'+ failed update of reval rates');
update igi_iac_revaluation_rates
set latest_record = 'Y'
where asset_id = l_txns.asset_id
and book_type_code = l_txns.book_type_code
and processed_flag = 'Y'
and adjustment_id = fp_adjustment_id
;
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+create, update or delete is not allowed.');
igi_iac_debug_pkg.debug_other_string(g_error_level,l_path,'+failed insert into reval rates');
update igi_iac_revaluations
set status = IGI_IAC_TYPES.gc_previewed_status
where revaluation_id = fp_reval_id
;
update igi_iac_revaluations
set status = IGI_IAC_TYPES.gc_failedpre_status
where revaluation_id = fp_reval_id
;
update igi_iac_revaluations
set status = IGI_IAC_TYPES.gc_completed_status,
event_id = p_event_id
where revaluation_id = fp_reval_id
and event_id is null;
update igi_iac_revaluations
set status = IGI_IAC_TYPES.gc_completed_status
where revaluation_id = fp_reval_id;
update igi_iac_revaluations
set status = IGI_IAC_TYPES.gc_failedrun_status
where revaluation_id = fp_reval_id
;
select 'x'
from igi_iac_reval_asset_rules
where revaluation_factor <> 1
and asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and revaluation_id = fp_reval_id
;
l_can_update boolean;
l_can_update := false;
l_can_update := true;
if l_can_update then
update igi_iac_adjustments
set transfer_to_gl_flag = 'Y'
where adjustment_id in ( select adjustment_id
from igi_iac_transaction_headers
where mass_reference_id = fp_reval_id
and book_type_code = fp_book_type_code
and asset_id = fp_asset_id
)
and asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and transfer_to_gl_flag = 'N'
;
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'Updated Transfer_to_gl_flag');
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'No records found to update transfer_to_gl_flag');
select 'x'
from igi_iac_reval_asset_rules
where revaluation_factor <> 1
and book_type_code = fp_book_type_code
and revaluation_id = fp_reval_id;
l_can_update boolean;
l_can_update := false;
l_can_update := true;
if l_can_update then
update igi_iac_adjustments
set event_id = fp_event_id
where adjustment_id in ( select adjustment_id
from igi_iac_transaction_headers
where mass_reference_id = fp_reval_id
and book_type_code = fp_book_type_code
)
and book_type_code = fp_book_type_code
and transfer_to_gl_flag = 'Y';
update igi_iac_transaction_headers
set event_id = fp_event_id
where mass_reference_id = fp_reval_id
and book_type_code = fp_book_type_code;
update igi_iac_transaction_headers
set adjustment_status = 'RUN'
where mass_Reference_id = fp_reval_id
and transaction_type_code = 'REVALUATION'
and asset_id = fp_asset_id
and adjustment_status = 'PREVIEW'
;
update igi_iac_transaction_headers
set adjustment_status = 'OBSOLETE'
where mass_Reference_id = fp_reval_id
and transaction_type_code = 'REVALUATION'
and asset_id = fp_asset_id
and adjustment_status = 'PREVIEW'
;
function update_balances
( fp_reval_id in IGI_IAC_REVALUATIONS.REVALUATION_ID%TYPE
, fp_asset_id in IGI_IAC_TRANSACTION_HEADERS.ASSET_ID%TYPE
, fp_period_counter in IGI_IAC_TRANSACTION_HEADERS.PERIOD_COUNTER%TYPE
, fp_book_type_code in IGI_IAC_TRANSACTION_HEADERS.BOOK_TYPE_CODE%TYPE
)
return boolean is
l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
select
nvl(net_book_value,0) net_book_value
,nvl(adjusted_cost,0) adjusted_cost
,nvl(operating_acct,0) operating_acct
,nvl(reval_reserve,0) reval_reserve
,nvl(deprn_amount,0) deprn_amount
,nvl(deprn_reserve,0) deprn_reserve
,nvl(backlog_deprn_reserve,0) backlog_deprn_reserve
,nvl(general_fund,0) general_fund
,last_reval_date
,current_reval_factor
,cumulative_reval_factor
from igi_iac_asset_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter = ( select 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 )
;
select
nvl(sum(net_book_value),0) net_book_value
,nvl(sum(adjustment_cost),0) adjusted_cost
,nvl(sum(operating_acct_net),0) operating_acct
,nvl(sum(reval_reserve_net),0) reval_reserve
,nvl(sum(deprn_period),0) deprn_amount
,nvl(sum(deprn_reserve),0) deprn_reserve
,nvl(sum(deprn_reserve_backlog),0) backlog_deprn_reserve
,nvl(sum(nvl(reval_reserve_gen_fund,0)),0) general_fund
from igi_iac_det_balances
where asset_id = fp_asset_id
and book_type_code = fp_book_type_code
and period_counter = fp_period_counter
and adjustment_id in ( select adjustment_id
from igi_iac_transaction_headers
where asset_id = fp_asset_id
and period_counter = fp_period_counter
and transaction_type_code = 'REVALUATION'
and mass_reference_id = fp_reval_id
and adjustment_id_out is null
)
;
select iar.revaluation_id, iar.revaluation_date
, iirar.revaluation_factor
from igi_iac_revaluations iar
, igi_iac_reval_asset_rules iirar
where iar.revaluation_id = fp_reval_id
and iirar.revaluation_id = fp_reval_id
and iirar.asset_id = fp_asset_id
and iirar.book_type_code = iar.book_type_code
;
l_path := g_path||'update_balances';
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'insert/update first record');
igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'insert/update second record');