The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT org_information2
INTO l_legal_entity
FROM hr_organization_information
WHERE organization_id = p_org_id
/** Bug#4496452 ANTHIYAG 08-May-2006 Start **/
AND org_information_context = 'Accounting Information';
SELECT COUNT(*)
INTO l_tcount
FROM mtl_material_transactions_temp
WHERE organization_id = p_org_id
AND trunc(transaction_date) <= l_sched_close_date
AND NVL(transaction_status,0) <> 2; -- 2 indicates a save-only status
SELECT period_start_date
INTO l_le_closing_fm_date
FROM org_acct_periods
WHERE acct_period_id = p_closing_period
AND organization_id = p_org_id;
SELECT COUNT(*)
INTO x_pend_receiving
FROM rcv_transactions_interface
WHERE to_organization_id = p_org_id
AND transaction_date <= l_sched_close_date
AND destination_type_code = 'INVENTORY';
SELECT COUNT(*)
INTO x_pend_matl
FROM mtl_transactions_interface
WHERE organization_id = p_org_id
AND transaction_date <= l_sched_close_date
AND process_flag <> 9;
SELECT COUNT(*)
INTO x_uncost_matl
FROM mtl_material_transactions
WHERE organization_id = p_org_id
AND transaction_date <= l_sched_close_date
AND costed_flag is not null;
SELECT COUNT(*)
INTO x_uncost_rsrc_txns
FROM gme_resource_txns
-- WHERE organization_id = p_org_id
WHERE p_org_id = p_org_id
AND doc_type = 'PROD'
AND posted_ind != 0
AND completed_ind = 1
AND delete_mark = 0
AND trans_date >= l_in_rec_type.closing_fm_date
AND trans_date <= l_sched_close_date;
SELECT COUNT(*)
INTO x_uncost_prod_batches
FROM gme_batch_header
-- WHERE organization_id = p_org_id
WHERE p_org_id = p_org_id
AND gl_posted_ind != 0
AND delete_mark = 0
AND actual_cmplt_date >= l_in_rec_type.closing_fm_date
AND actual_cmplt_date <= l_sched_close_date;
SELECT acct_period_id
FROM org_acct_periods
WHERE organization_id = p_org_id
AND schedule_close_date = (SELECT MIN(oap1.schedule_close_date)
FROM org_acct_periods oap1, org_acct_periods oap2
WHERE
oap1.organization_id = p_org_id
AND (oap1.open_flag = 'Y' or oap1.open_flag = 'P')
and oap2.organization_id = oap1.organization_id
and oap1.schedule_close_date < oap2.schedule_close_date
and oap2.acct_period_id = p_closing_acct_period_id);
SELECT acct_period_id
FROM org_acct_periods
WHERE organization_id = p_org_id
AND acct_period_id = p_closing_acct_period_id
AND (open_flag = 'Y' or open_flag = 'P');
SELECT MIN(acct_period_id)
FROM org_acct_periods
WHERE organization_id = p_org_id
AND acct_period_id > p_closing_acct_period_id;
SELECT acct_period_id
FROM org_gl_batches
WHERE organization_id = p_org_id
AND gl_batch_id = 0;
SELECT acct_period_id
FROM org_acct_periods
WHERE organization_id = p_org_id
AND acct_period_id = p_closing_acct_period_id
AND period_close_date IS NOT NULL
AND open_flag = 'P';
SELECT org_information3
INTO l_operating_unit
FROM hr_organization_information
WHERE organization_id = p_org_id
AND org_information_context = 'Accounting Information';
UPDATE org_acct_periods
SET
open_flag = 'P',
period_close_date = trunc(sysdate),
last_update_date = trunc(sysdate),
last_updated_by = p_user_id,
last_update_login = p_login_id
WHERE
acct_period_id = p_closing_acct_period_id AND
-- program level check to make sure that
-- the period is only closed once
open_flag = 'Y' AND
organization_id = p_org_id
;
SELECT gps.period_id
FROM gmf_period_statuses gps
WHERE gps.legal_entity_id = cp_le_id
AND gps.cost_type_id = cp_ct_id
AND gps.end_date = cp_end_date
ORDER BY gps.end_date desc
;
SELECT oap.period_year, oap.period_num
INTO x_inv_period_year, x_inv_period_num
FROM org_acct_periods oap,
gmf_period_statuses gps,
hr_organization_information hoi
WHERE gps.period_id = l_prev_period_id
AND gps.legal_entity_id = hoi.org_information2
AND hoi.org_information_context = 'Accounting Information'
AND oap.organization_id = hoi.organization_id
AND oap.schedule_close_date = TRUNC(gps.end_date)
AND rownum = 1
;
SELECT SUM(decode(open_flag,'Y',1,'P',1, 0))
INTO l_open_periods_cnt
FROM org_acct_periods oap,
mtl_parameters mp,
hr_organization_information hoi
WHERE hoi.org_information2 = p_legal_entity_id
AND hoi.org_information_context = 'Accounting Information'
AND hoi.organization_id = oap.organization_id
AND hoi.organization_id = mp.organization_id
AND mp.process_enabled_flag = 'Y'
AND oap.period_year = x_inv_period_year
AND oap.period_num = x_inv_period_num
AND oap.schedule_close_date = TRUNC(p_period_end_date)
;