The following lines contain the word 'select', 'insert', 'update' or 'delete':
LV_Last_Update_Login fa_mass_retirements.Last_Update_Login%TYPE;
v_last_update_login NUMBER;
SELECT ret.asset_id,
ret.rowid,
ret.status,
ret.retirement_id,
ret.transaction_header_id_in,
-- ret.transaction_header_id_out
ret.cost_retired,
ret.units,
ret.date_effective,
ret.retirement_prorate_convention,
ret.nbv_retired,
ret.gain_loss_amount,
ret.proceeds_of_sale,
ret.cost_of_removal,
ret.gain_loss_type_code,
ret.retirement_type_code,
ret.itc_recaptured ,
ret.itc_recapture_id ,
ret.stl_method_code ,
ret.stl_life_in_months ,
ret.stl_deprn_amount ,
ret.reval_reserve_retired,
ret.unrevalued_cost_retired,
ret.book_type_code,
ihrd.current_cost
FROM fa_retirements ret,
fa_hr_retirement_details ihrd
WHERE ihrd.batch_id = x_batch_num
AND ret.retirement_id = ihrd.retirement_id
AND ret.transaction_header_id_out IS NULL
AND ret.date_retired BETWEEN x_fy_Start_Date
AND x_fy_End_Date
FOR UPDATE NOWAIT;
SELECT distribution_id,
units_Assigned,
transaction_header_id_in,
transaction_units,
transaction_header_id_out
FROM fa_distribution_history
WHERE retirement_id = LV_retirement_id
FOR UPDATE NOWAIT ;
v_last_update_login:= nvl(TO_NUMBER(fnd_profile.value('LOGIN_ID')),-1);
UPDATE fa_hr_retirement_headers
set status_code = 'RF' -- Reinstatement Failed
where batch_id = x_batch_num;
update fa_hr_retirement_headers
set status_code = 'RC' -- reinstatement completed
where batch_id = x_batch_num;
update fa_hr_retirement_details
set status_code = 'RI' -- reinstated
where batch_id = x_batch_num;
UPDATE fa_hr_retirement_headers
set status_code = 'RF' -- Reinstatement Failed
where batch_id = x_batch_num;
SELECT ihrh.batch_id,
ihrh.concurrent_request_id,
ihrh.book_type_code,
ihrh.retire_date ,
sob.currency_code,
ffy.start_date,
ffy.end_date
, ihrh.attribute_category
, ihrh.attribute1
, ihrh.attribute2
, ihrh.attribute3
, ihrh.attribute4
, ihrh.attribute5
, ihrh.attribute6
, ihrh.attribute7
, ihrh.attribute8
, ihrh.attribute9
, ihrh.attribute10
, ihrh.attribute11
, ihrh.attribute12
, ihrh.attribute13
, ihrh.attribute14
, ihrh.attribute15
, ihrh.TH_attribute_category
, ihrh.TH_attribute1
, ihrh.TH_attribute2
, ihrh.TH_attribute3
, ihrh.TH_attribute4
, ihrh.TH_attribute5
, ihrh.TH_attribute6
, ihrh.TH_attribute7
, ihrh.TH_attribute8
, ihrh.TH_attribute9
, ihrh.TH_attribute10
, ihrh.TH_attribute11
, ihrh.TH_attribute12
, ihrh.TH_attribute13
, ihrh.TH_attribute14
, ihrh.TH_attribute15
FROM fa_hr_retirement_headers ihrh,
fa_book_controls fbc,
gl_sets_of_books sob,
fa_fiscal_year ffy
WHERE ihrh.batch_id >= nvl(x_from_batch_num, ihrh.batch_id )
AND ihrh.batch_id <= nvl(x_to_batch_num, ihrh.batch_id)
AND ihrh.status_code IN ( 'RP', 'CP', 'RC') --completely processed or completely reinstated
AND ihrh.book_type_code = fbc.book_type_code
AND fbc.set_of_books_id = sob.set_of_books_id
AND ffy.fiscal_year_name = fbc.fiscal_year_name
AND ffy.fiscal_year = fbc.current_fiscal_year
FOR UPDATE NOWAIT;
update fa_hr_retirement_headers
set status_code = 'RP'
where batch_id = hrh_rec.batch_id;
update fa_hr_retirement_details
set status_code = 'RP'
where batch_id = hrh_rec.batch_id;