The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT depreciate_flag
FROM fa_books
WHERE book_type_code = cp_book_type_code
AND asset_id = cp_asset_id
AND date_ineffective IS NULL;
SELECT period_counter,
net_book_value,
adjusted_cost,
operating_acct,
reval_reserve,
deprn_amount,
deprn_reserve,
backlog_deprn_reserve,
general_fund,
last_reval_date,
current_reval_factor,
cumulative_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;
SELECT iidb.adjustment_id,
iidb.distribution_id,
iidb.period_counter,
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_ytd,
iidb.operating_acct_net,
iidb.deprn_period,
iidb.deprn_ytd,
iidb.deprn_reserve,
iidb.deprn_reserve_backlog,
iidb.general_fund_per,
iidb.general_fund_acc,
iidb.last_reval_date,
iidb.current_reval_factor,
iidb.cumulative_reval_factor,
iidb.active_flag
FROM igi_iac_det_balances iidb
WHERE iidb.adjustment_id = cp_adjust_id
AND iidb.book_type_code = cp_book_type_code
AND iidb.asset_id = cp_asset_id
AND iidb.distribution_id = cp_dist_id
AND iidb.active_flag IS NULL
ORDER BY iidb.distribution_id;
SELECT iifd.deprn_ytd,
iifd.deprn_period,
iifd.deprn_reserve
FROM igi_iac_fa_deprn iifd
WHERE iifd.adjustment_id = cp_adjustment_id
AND iifd.distribution_id = cp_distribution_id
AND iifd.active_flag IS NULL;
SELECT SUM(NVL(deprn_amount,0)) deprn_amount,
SUM(NVL(deprn_adjustment_amount,0)) deprn_adjustment_amount,
SUM(NVL(deprn_reserve,0)) deprn_reserve
FROM fa_deprn_detail
WHERE book_type_code = cp_book_type_code
AND asset_id = cp_asset_id
AND period_counter = cp_period_counter;
SELECT ah.pre_adjusted_cost, ah.pre_salvage_value
FROM igi_iac_adjustments_history ah
WHERE ah.book_type_code = cp_book_type_code
AND ah.asset_id = cp_asset_id
AND ah.transaction_header_id_in = (SELECT min(iah.transaction_header_id_in)
FROM igi_iac_adjustments_history iah
WHERE iah.book_type_code = cp_book_type_code
AND iah.asset_id = cp_asset_id
AND iah.period_counter = cp_period_counter);
SELECT asset_number
INTO g_asset_num
FROM fa_additions
WHERE asset_id = l_asset_id;
SELECT period_counter
INTO l_rsvd_pc
FROM igi_iac_transaction_headers
WHERE adjustment_id = l_latest_adj_id;
IGI_IAC_TRANS_HEADERS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id, -- out NOCOPY parameter
x_transaction_header_id => p_adj_hist.transaction_header_id_in, -- bug 3391000 null,
x_adjustment_id_out => null,
x_transaction_type_code => 'DEPRECIATION',
x_transaction_date_entered => sysdate,
x_mass_refrence_id => null,
x_transaction_sub_type => 'ADJUSTMENT',
x_book_type_code => l_book_type_code,
x_asset_id => l_asset_id,
x_category_id => p_adj_hist.category_id,
x_adj_deprn_start_date => null,
x_revaluation_type_flag => null,
x_adjustment_status => 'COMPLETE',
x_period_counter => l_last_period_counter,
x_event_id => p_event_id
);
IGI_IAC_TRANS_HEADERS_PKG.Update_Row(
x_prev_adjustment_id => l_adj_id_out,
x_adjustment_id => l_new_adj_id
);
IGI_IAC_DET_BALANCES_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_asset_id => l_asset_id,
x_book_type_code => l_book_type_code,
x_distribution_id => l_dist_id,
x_period_counter => l_last_period_counter,
x_adjustment_cost => l_det_bal.adjustment_cost,
x_net_book_value => l_new_dist_nbv, -- l_det_bal.net_book_value,
x_reval_reserve_cost => l_det_bal.reval_reserve_cost,
x_reval_reserve_backlog => l_det_bal.reval_reserve_backlog,
x_reval_reserve_gen_fund => l_new_dist_rr_gf, -- l_det_bal.reval_reserve_gen_fund,
x_reval_reserve_net => l_new_dist_rr_net, -- l_det_bal.reval_reserve_net,
x_operating_acct_cost => l_det_bal.operating_acct_cost,
x_operating_acct_backlog => l_det_bal.operating_acct_backlog,
x_operating_acct_net => l_det_bal.operating_acct_net,
x_operating_acct_ytd => l_det_bal.operating_acct_ytd,
x_deprn_period => l_iac_deprn_period_amount,
x_deprn_ytd => l_new_dist_dep_ytd,
x_deprn_reserve => l_new_dist_dep_rsv,
x_deprn_reserve_backlog => l_det_bal.deprn_reserve_backlog,
x_general_fund_per => l_new_dist_gf_per, -- l_det_bal.general_fund_per,
x_general_fund_acc => l_new_dist_gf_acc, -- l_det_bal.general_fund_acc,
x_last_reval_date => l_det_bal.last_reval_date,
x_current_reval_factor => l_det_bal.current_reval_factor,
x_cumulative_reval_factor => l_det_bal.cumulative_reval_factor,
x_active_flag => null,
x_mode => 'R'
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'DR',
x_amount => l_new_dist_dep_prd,
x_adjustment_type => 'EXPENSE',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => 'RESERVE',
x_report_ccid => Null,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'CR',
x_amount => l_new_dist_dep_prd,
x_adjustment_type => 'RESERVE',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => 'EXPENSE',
x_report_ccid => Null,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_reval_rsv_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'DR',
x_amount => l_new_dist_dep_prd,
x_adjustment_type => 'REVAL RESERVE',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => 'GENERAL FUND',
x_report_ccid => Null ,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'CR',
x_amount => l_new_dist_dep_prd,
x_adjustment_type => 'GENERAL FUND',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => 'REVAL RESERVE',
x_report_ccid => l_reval_rsv_ccid ,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_FA_DEPRN_PKG.Insert_Row(
x_rowid => l_rowid,
x_book_type_code => l_book_type_code,
x_asset_id => l_asset_id,
x_period_counter => l_last_period_counter,
x_adjustment_id => l_new_adj_id,
x_distribution_id => p_asset_iac_dist_info(l_fa_idx).distribution_id,
x_deprn_period => l_fa_deprn_period_amount,
x_deprn_ytd => l_fa_deprn_ytd,
x_deprn_reserve => l_fa_deprn_reserve,
x_active_flag => null,
x_mode => 'R'
);
p_string => 'IAC FA Deprn row inserted: '||l_new_adj_id);
SELECT count(*)
INTO l_exists
FROM igi_iac_asset_balances
WHERE asset_id = l_asset_id
AND book_type_code = l_book_type_code
AND period_counter = l_last_period_counter;
IGI_IAC_ASSET_BALANCES_PKG.Update_Row(
X_asset_id => l_asset_id,
X_book_type_code => l_book_type_code,
X_period_counter => l_iac_asset_bal.period_counter,
X_net_book_value => l_iac_new_nbv, -- l_iac_asset_bal.net_book_value,
X_adjusted_cost => l_iac_asset_bal.adjusted_cost,
X_operating_acct => l_iac_asset_bal.operating_acct,
X_reval_reserve => l_iac_new_rr, -- l_iac_asset_bal.reval_reserve,
X_deprn_amount => l_iac_deprn_period_amount,
X_deprn_reserve => l_iac_new_deprn_reserve,
X_backlog_deprn_reserve => l_iac_asset_bal.backlog_deprn_reserve,
X_general_fund => l_iac_new_gf, -- l_iac_asset_bal.general_fund,
X_last_reval_date => l_iac_asset_bal.last_reval_date,
X_current_reval_factor => l_iac_asset_bal.current_reval_factor,
X_cumulative_reval_factor => l_iac_asset_bal.cumulative_reval_factor
) ;
IGI_IAC_ASSET_BALANCES_PKG.Insert_Row(
X_rowid => l_rowid,
X_asset_id => l_asset_id,
X_book_type_code => l_book_type_code,
X_period_counter => l_last_period_counter,
X_net_book_value => l_iac_new_nbv, -- l_iac_asset_bal.net_book_value,
X_adjusted_cost => l_iac_asset_bal.adjusted_cost,
X_operating_acct => l_iac_asset_bal.operating_acct,
X_reval_reserve => l_iac_new_rr, -- l_iac_asset_bal.reval_reserve,
X_deprn_amount => l_iac_deprn_period_amount,
X_deprn_reserve => l_iac_new_deprn_reserve,
X_backlog_deprn_reserve => l_iac_asset_bal.backlog_deprn_reserve,
X_general_fund => l_iac_new_gf, -- l_iac_asset_bal.general_fund,
X_last_reval_date => l_iac_asset_bal.last_reval_date,
X_current_reval_factor => l_iac_asset_bal.current_reval_factor,
X_cumulative_reval_factor => l_iac_asset_bal.cumulative_reval_factor
) ;