The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_num,
ps.period_year
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.start_date <= trunc(active_date)
AND ps.end_date >= trunc(active_date)
AND ps.closing_status IN ('O', 'F')
ORDER BY ps.effective_period_num ASC;
SELECT ps.period_name, ps.closing_status, ps.start_date, ps.end_date,
ps.period_num, ps.period_year
INTO x_active_period, period_status, x_per_start_date, x_per_end_date,
x_per_number, x_per_year
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = calendar
AND map.period_type = per_type
AND map.accounting_date = trunc(active_date)
AND ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.period_name = map.period_name;
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_num,
ps.period_year
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.start_date <= trunc(active_date)
AND ps.end_date >= trunc(active_date)
AND ps.period_year <= x_latest_year
ORDER BY ps.effective_period_num ASC;
SELECT latest_encumbrance_year
INTO x_latest_year
FROM gl_ledgers
WHERE ledger_id = lgr_id;
SELECT ps.period_name, ps.start_date, ps.end_date,
ps.period_num, ps.period_year
INTO x_active_period, x_per_start_date, x_per_end_date,
x_per_number, x_per_year
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = calendar
AND map.period_type = per_type
AND map.accounting_date = trunc(active_date)
AND ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.period_name = map.period_name;
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_num,
ps.period_year
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = one_ledger_id
AND ps.start_date <= trunc(active_date)
AND ps.end_date >= trunc(active_date)
AND ps.period_year <= one_latest_year
AND NOT EXISTS
(SELECT 'not open or future'
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND nvl(lgr.latest_encumbrance_year,-1) < ps.period_year)
ORDER BY ps.effective_period_num ASC;
SELECT lgr.ledger_id, lgr.latest_encumbrance_year
INTO one_ledger_id, one_latest_year
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND rownum = 1;
SELECT ps.period_name, ps.start_date, ps.end_date,
ps.period_num, ps.period_year
INTO x_active_period, x_per_start_date, x_per_end_date,
x_per_number, x_per_year
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = calendar
AND map.period_type = per_type
AND map.accounting_date = trunc(active_date)
AND ps.application_id = 101
AND ps.ledger_id = one_ledger_id
AND ps.period_name = map.period_name
AND ps.period_year <= one_latest_year
AND NOT EXISTS
(SELECT 'not open or future'
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND nvl(lgr.latest_encumbrance_year,-1) < ps.period_year);
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_year,
ps.period_num
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.start_date <= trunc(initial_accounting_date)
AND ps.end_date >= trunc(initial_accounting_date)
AND ps.closing_status IN ('O', 'F')
AND ps.effective_period_num >= min_eff_period_num
ORDER BY ps.effective_period_num ASC;
SELECT period_set_name, transaction_calendar_id, accounted_period_type
INTO acct_cal_name, trans_cal_id, acc_period_type
FROM gl_ledgers
WHERE ledger_id = lgr_id;
SELECT effective_period_num
INTO min_eff_period_num
FROM gl_period_statuses
WHERE application_id = 101
AND ledger_id = lgr_id
AND period_name = minimum_period;
SELECT ps.period_name, ps.closing_status, ps.start_date, ps.end_date,
ps.period_year, ps.period_num
INTO x_period_name, period_status, period_start_date,
period_end_date, tmp_year, tmp_num
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = acct_cal_name
AND map.period_type = acc_period_type
AND map.accounting_date = initial_accounting_date
AND ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.period_name = map.period_name
AND ps.effective_period_num >= min_eff_period_num;
SELECT ps.closing_status, ps.start_date, ps.end_date,
ps.period_year, ps.period_num
INTO period_status, period_start_date, period_end_date,
tmp_year, tmp_num
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.period_name = x_period_name
AND ps.effective_period_num >= min_eff_period_num;
SELECT business_day_flag
INTO business_day
FROM gl_transaction_dates
WHERE transaction_calendar_id = trans_cal_id
AND transaction_date = initial_accounting_date;
SELECT max(transaction_date)
INTO new_accounting_date
FROM gl_transaction_dates trans
WHERE trans.transaction_calendar_id = trans_cal_id
AND trans.transaction_date >= greatest(period_start_date,
nvl(minimum_date,
period_start_date))
AND trans.business_day_flag = 'Y'
AND trans.transaction_date < initial_accounting_date;
SELECT min(transaction_date)
INTO new_accounting_date
FROM gl_transaction_dates trans
WHERE trans.transaction_calendar_id = trans_cal_id
AND trans.transaction_date <= period_end_date
AND trans.business_day_flag = 'Y'
AND trans.transaction_date > initial_accounting_date;
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_year,
ps.period_num
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = one_ledger_id
AND ps.start_date <= trunc(initial_accounting_date)
AND ps.end_date >= trunc(initial_accounting_date)
AND ps.effective_period_num >= min_eff_period_num
AND ps.closing_status IN ('O', 'F')
AND NOT EXISTS
(SELECT 'not open or future'
FROM gl_je_headers jeh, gl_period_statuses ps2
WHERE jeh.je_batch_id = batch_id
AND ps2.application_id = 101
AND ps2.ledger_id = jeh.ledger_id
AND ps2.period_name = ps.period_name
AND ps2.closing_status NOT IN ('O', 'F'))
ORDER BY ps.effective_period_num ASC;
SELECT min(lgr.period_set_name), min(lgr.accounted_period_type),
min(lgr.transaction_calendar_id), min(lgr.ledger_id)
INTO acct_cal_name, acc_period_type, one_trans_cal_id, one_ledger_id
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id;
SELECT period_year * 10000 + period_num
INTO min_eff_period_num
FROM gl_periods
WHERE period_set_name = acct_cal_name
AND period_type = acc_period_type
AND period_name = minimum_period;
SELECT ps.period_name, ps.closing_status, ps.start_date, ps.end_date,
ps.period_year, ps.period_num
INTO x_period_name, period_status, period_start_date,
period_end_date, tmp_year, tmp_num
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = acct_cal_name
AND map.period_type = acc_period_type
AND map.accounting_date = initial_accounting_date
AND ps.application_id = 101
AND ps.ledger_id = one_ledger_id
AND ps.period_name = map.period_name
AND ps.effective_period_num >= min_eff_period_num
AND ps.closing_status IN ('O', 'F')
AND NOT EXISTS
(SELECT 'not open or future'
FROM gl_je_headers jeh, gl_period_statuses ps2
WHERE jeh.je_batch_id = batch_id
AND ps2.application_id = 101
AND ps2.ledger_id = jeh.ledger_id
AND ps2.period_name = ps.period_name
AND ps2.closing_status NOT IN ('O', 'F'));
SELECT ps.closing_status, ps.start_date, ps.end_date,
ps.period_year, ps.period_num
INTO period_status, period_start_date, period_end_date,
tmp_year, tmp_num
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = one_ledger_id
AND ps.period_name = x_period_name
AND ps.effective_period_num >= min_eff_period_num
AND ps.closing_status IN ('O', 'F')
AND NOT EXISTS
(SELECT 'not open or future'
FROM gl_je_headers jeh, gl_period_statuses ps2
WHERE jeh.je_batch_id = batch_id
AND ps2.application_id = 101
AND ps2.ledger_id = jeh.ledger_id
AND ps2.period_name = ps.period_name
AND ps2.closing_status NOT IN ('O', 'F'));
SELECT nvl(max('Y'),'N')
INTO roll_dates
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND lgr.enable_average_balances_flag = 'Y'
AND lgr.consolidation_ledger_flag = 'N'
AND rownum = 1;
SELECT decode(min(decode(business_day_flag, 'Y', 1, 0)),1, 'Y', 'N')
INTO business_day
FROM gl_transaction_dates
WHERE transaction_calendar_id
IN (SELECT transaction_calendar_id
FROM gl_je_headers jeh, gl_ledgers lgr
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id)
AND transaction_date = initial_accounting_date;
SELECT max(transaction_date)
INTO new_accounting_date
FROM gl_transaction_dates trans
WHERE trans.transaction_calendar_id = one_trans_cal_id
AND trans.transaction_date >= greatest(period_start_date,
nvl(minimum_date,
period_start_date))
AND trans.business_day_flag = 'Y'
AND trans.transaction_date < initial_accounting_date
AND NOT EXISTS
(SELECT 'not business'
FROM gl_je_headers jeh, gl_ledgers lgr,
gl_transaction_dates trans2
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND trans2.transaction_calendar_id
= lgr.transaction_calendar_id
AND trans2.business_day_flag = 'N'
AND trans2.transaction_date = trans.transaction_date);
SELECT min(transaction_date)
INTO new_accounting_date
FROM gl_transaction_dates trans
WHERE trans.transaction_calendar_id = one_trans_cal_id
AND trans.transaction_date <= period_end_date
AND trans.business_day_flag = 'Y'
AND trans.transaction_date > initial_accounting_date
AND NOT EXISTS
(SELECT 'not business'
FROM gl_je_headers jeh, gl_ledgers lgr,
gl_transaction_dates trans2
WHERE jeh.je_batch_id = batch_id
AND lgr.ledger_id = jeh.ledger_id
AND trans2.transaction_calendar_id
= lgr.transaction_calendar_id
AND trans2.business_day_flag = 'N'
AND trans2.transaction_date = trans.transaction_date);
SELECT ps.period_name, ps.start_date, ps.end_date, ps.period_num,
ps.period_year
FROM gl_period_statuses ps
WHERE ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.start_date <= trunc(active_date)
AND ps.end_date >= trunc(active_date)
AND ps.closing_status IN ('O', 'C', 'P')
ORDER BY ps.effective_period_num ASC;
SELECT ps.period_name, ps.closing_status, ps.start_date, ps.end_date,
ps.period_num, ps.period_year
INTO x_from_period, period_status, x_per_start_date, x_per_end_date,
x_per_number, x_per_year
FROM gl_date_period_map map, gl_period_statuses ps
WHERE map.period_set_name = calendar
AND map.period_type = per_type
AND map.accounting_date = trunc(active_date)
AND ps.application_id = 101
AND ps.ledger_id = lgr_id
AND ps.period_name = map.period_name;