The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT chart_of_accounts_id,
enable_budgetary_control_flag,
enable_automatic_tax_flag,
enable_je_approval_flag,
GL_JE_POSTING_S.nextval
FROM GL_LEDGERS
WHERE ledger_id = p_ledger_id;
SELECT max(JEH.ledger_id)
FROM GL_JE_BATCHES JEB,
GL_JE_HEADERS JEH
WHERE JEB.status = 'S'
AND JEB.posting_run_id = p_posting_run_id
AND JEH.je_batch_id = JEB.je_batch_id
GROUP BY JEB.posting_run_id
HAVING count(distinct JEH.ledger_id) = 1;
SELECT '1'
FROM GL_JE_BATCHES JEB,
GL_JE_HEADERS JEH
WHERE JEB.status = 'S'
AND JEB.posting_run_id = p_posting_run_id
AND JEH.je_batch_id = JEB.je_batch_id
AND JEH.actual_flag <> 'B'
AND JEH.reversed_je_header_id IS NULL
AND EXISTS
(SELECT 1
FROM GL_LEDGER_RELATIONSHIPS LRL
WHERE LRL.source_ledger_id = JEH.ledger_id
AND LRL.target_ledger_category_code = 'ALC'
AND LRL.relationship_type_code IN ('JOURNAL', 'SUBLEDGER')
AND LRL.application_id = 101
AND LRL.relationship_enabled_flag = 'Y'
AND JEH.je_source NOT IN
(SELECT INC.je_source_name
FROM GL_JE_INCLUSION_RULES INC
WHERE INC.je_rule_set_id =
LRL.gl_je_conversion_set_id
AND INC.je_source_name = JEH.je_source
AND INC.je_category_name = 'Other'
AND INC.include_flag = 'N'
AND INC.user_updatable_flag = 'N'));
ok_to_update_batch BOOLEAN;
SELECT b.je_batch_id,
b.status,
b.default_period_name,
b.actual_flag,
b.request_id
FROM gl_je_batches b
WHERE (b.status < ''P'' OR b.status > ''P'')
AND b.status_verified = ''N''
AND b.budgetary_control_status != ''I''
AND greatest(nvl(b.running_total_dr,0),nvl(b.running_total_cr,0)) =
decode(b.control_total,null, greatest(nvl(b.running_total_dr,0),
nvl(b.running_total_cr,0)), b.control_total) ';
(SELECT h.je_batch_id
FROM GL_LEDGERS ledger,
GL_JE_HEADERS h,
GL_BUDGETS glb,
GL_BUDGET_VERSIONS bv,
GL_PERIOD_STATUSES ps1,
GL_PERIOD_STATUSES ps2
WHERE ps2.ledger_id = '||v_ledger_id||'
AND ps2.application_id = 101
AND ps1.ledger_id (+) = '||v_ledger_id||'
AND ps1.application_id (+) = 101
AND ledger.ledger_id = '||v_ledger_id||'
AND h.ledger_id = '||v_ledger_id||'
AND h.period_name = ps2.period_name
AND ps2.period_year <=
decode(h.actual_flag,
''E'', ledger.latest_encumbrance_year,
''B'', glb.latest_opened_year,
''A'', decode (ps2.closing_status,''O'',ps2.period_year, -1))
AND ps2.period_year >=
decode(h.actual_flag,
''B'', ps1.period_year,
ps2.period_year)
AND b.je_batch_id = h.je_batch_id
AND h.budget_version_id = bv.budget_version_id (+)
AND bv.budget_name = glb.budget_name (+)
AND glb.status (+) != ''F''
AND ps1.period_name (+) = glb.first_valid_period_name ';
AND NOT EXISTS (SELECT 1
FROM GL_JE_HEADERS h
WHERE h.je_batch_id = b.je_batch_id
AND (';
AND NOT EXISTS (SELECT 1
FROM GL_JE_HEADERS glh
WHERE glh.tax_status_code = ''R''
AND glh.je_batch_id = b.je_batch_id
AND b.actual_flag = ''A''
AND glh.currency_code != ''STAT''
AND glh.je_source = ''Manual'')';
FOR UPDATE OF status, posting_run_id NOWAIT ';
Debug_Print_Msg('SQL Statement to select batches:');
ok_to_update_batch := FALSE;
ok_to_update_batch := FALSE;
ok_to_update_batch := TRUE;
ok_to_update_batch := TRUE;
ok_to_update_batch := FALSE;
ok_to_update_batch := TRUE;
IF (ok_to_update_batch) THEN
UPDATE gl_je_batches
SET status = 'S',
posting_run_id = v_posting_run_id
WHERE je_batch_id = v_je_batch_id;
IF (ok_to_update_batch) THEN
Debug_Print_Msg('Batch with ID '||v_je_batch_id||' selected for posting');
Debug_Print_Msg('The number of batch selected for posting is :'||v_count_sel_bat);
UPDATE GL_CONSOLIDATION_HISTORY
SET status = 'PS',
request_id = v_request_id
WHERE je_batch_id IN (SELECT je_batch_id
FROM gl_je_batches
WHERE posting_run_id = v_posting_run_id
AND status = 'S');
UPDATE GL_ELIMINATION_HISTORY EH
SET EH.status_code = 'PS',
EH.request_id = v_request_id
WHERE EH.je_batch_id IN (SELECT je_batch_id
FROM gl_je_batches
WHERE posting_run_id = v_posting_run_id
AND status = 'S');