The following lines contain the word 'select', 'insert', 'update' or 'delete':
select bc.book_type_code
into X_Book_Type_Code
from fa_book_controls bc,
fa_books bk
where bk.asset_id = X_Asset_Id
and bk.book_type_code = bc.book_type_code
and bk.date_ineffective is null
and nvl(bc.date_ineffective, sysdate+1) > sysdate
and bc.book_class = 'CORPORATE';
select greatest(calendar_period_open_date,
least(sysdate, calendar_period_close_date)),
calendar_period_open_date,
calendar_period_close_date,
period_counter
into X_Transaction_Date_Entered,
X_Calendar_Period_Open_Date,
X_Calendar_Period_Close_Date,
X_Current_PC
from fa_deprn_periods
where book_type_code = X_Book_Type_Code
and period_close_date is null;
select dp.period_counter
into X_Transfer_In_PC
from fa_deprn_periods dp, fa_transaction_headers th
where th.asset_id = X_Asset_Id
and th.book_type_code = X_Book_Type_Code
and th.transaction_type_code = 'TRANSFER IN'
and dp.book_type_code = X_Book_Type_Code
and th.date_effective between dp.period_open_date
and nvl(dp.period_close_date, sysdate);
select fiscal_year_name, current_fiscal_year
into lv_fiscal_year_name, lv_fiscal_year
from fa_book_controls
where book_type_code = X_Book_Type_Code;
select start_date, end_date
into X_FY_Start_Date, X_FY_End_Date
from fa_fiscal_year
where fiscal_year = lv_fiscal_year
and fiscal_year_name = lv_fiscal_year_name;
/* select max(transaction_date_entered)
into X_Max_Transaction_Date
from fa_transaction_headers
where asset_id = X_Asset_Id
and book_type_code = X_Book_Type_Code; */
select units into lv_ah_units
from fa_asset_history
where asset_id = X_Asset_Id
and date_ineffective is null;
select sum(units_assigned - nvl(transaction_units, 0))
into lv_dh_units
from fa_distribution_history
where asset_id = X_Asset_Id
and book_type_code = X_Book_Type_Code
and date_ineffective is null;
select count(*)
into lv_count
from fa_books bk, fa_book_controls bc
where bk.asset_id = X_Asset_Id
and bk.date_ineffective is null
and bk.book_type_code = bc.book_type_code
and bc.book_class = 'BUDGET'
and nvl(bc.date_ineffective, sysdate+1) > sysdate;
select count(*)
into lv_count
from fa_retirements
where asset_id = X_Asset_Id
and book_type_code = X_Book_Type_Code
and status in ('PENDING','REINSTATE');
select count(*)
into lv_count
from fa_books
where asset_id = X_Asset_Id
and book_type_code = X_Book_Type_Code
and date_ineffective is null
and period_counter_fully_retired is not null;
-- if asset in (CIP) ADDITION period in assoc TAX books, update
-- distributions in those books
-- do this in the form, using INS_DETAIL
select count(1)
into lv_count
from fa_transaction_headers th,
fa_deprn_periods dp,
fa_book_controls bc
where bc.book_class <> 'CORPORATE'
and bc.distribution_source_book = X_Book_Type_Code
and th.book_type_code = bc.book_type_code
and th.asset_id = X_Asset_Id
and th.transaction_type_code||'' in ('ADDITION','CIP ADDITION')
and dp.book_type_code = bc.book_type_code
and dp.period_close_date is null
and th.date_effective >= dp.period_open_date
and bc.date_ineffective is null;
select asset_type, category_id
into X_Asset_Type, X_Category_Id
from fa_asset_history
where asset_id = X_Asset_Id
and date_ineffective is null;
select accounting_flex_structure
into X_Acct_Flex_Num
from fa_book_controls
where book_type_code = X_Book_Type_Code;