The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT APPLICATION_ID
,LEDGER_ID
,ENTITY_ID
INTO L_APPLICATION_ID
,L_LEDGER_ID
,L_ENTITY_ID
FROM XLA_TRANSACTION_ENTITIES
WHERE ENTITY_ID = P_ENTITY_ID;
SELECT APPLICATION_ID
,LEDGER_ID
,ENTITY_ID
INTO L_APPLICATION_ID
,L_LEDGER_ID
,L_ENTITY_ID
FROM XLA_TRANSACTION_ENTITIES
WHERE ENTITY_ID = P_ENTITY_ID
AND application_id = p_application_id;
UPDATE xla_acct_prog_docs_gt xap
SET entity_id =
(SELECT xte.entity_id
FROM xla_transaction_entities xte
WHERE xte.application_id = p_application_id
AND xte.ledger_id = xap.ledger_id
AND xte.entity_code = xap.entity_type_code
AND NVL(xte.valuation_method,C_CHAR) = NVL(xap.valuation_method,C_CHAR)
AND NVL(xte.source_id_int_1,C_NUM) = NVL(xap.source_id_int_1,C_NUM)
AND NVL(xte.source_id_int_2,C_NUM) = NVL(xap.source_id_int_2,C_NUM)
AND NVL(xte.source_id_int_3,C_NUM) = NVL(xap.source_id_int_3,C_NUM)
AND NVL(xte.source_id_int_4,C_NUM) = NVL(xap.source_id_int_4,C_NUM)
AND NVL(xte.source_id_char_1,C_CHAR) = NVL(xap.source_id_char_1,C_CHAR)
AND NVL(xte.source_id_char_2,C_CHAR) = NVL(xap.source_id_char_2,C_CHAR)
AND NVL(xte.source_id_char_3,C_CHAR) = NVL(xap.source_id_char_3,C_CHAR)
AND NVL(xte.source_id_char_4,C_CHAR) = NVL(xap.source_id_char_4,C_CHAR))
WHERE xap.entity_id IS NULL;
SELECT count(*) INTO l_count
FROM xla_acct_prog_docs_gt xap
WHERE entity_id IS NULL
OR NOT EXISTS (SELECT entity_id
FROM xla_transaction_entities xte
WHERE xte.application_id = p_application_id
AND xte.entity_id = xap.entity_id);
INSERT INTO XLA_ACCT_PROG_EVENTS_GT(event_id, ledger_id)
SELECT xe.event_id, xte.ledger_id
FROM xla_acct_prog_docs_gt xap
,xla_events xe
,xla_transaction_entities xte
WHERE xte.application_id = p_application_id
AND xte.entity_id = xap.entity_id
AND xap.entity_id IS NOT NULL
AND xe.application_id = xte.application_id
AND xe.entity_id = xte.entity_id
AND NVL(budgetary_control_flag,'N') = DECODE(p_accounting_mode
,'D','N'
,'F','N'
,'Y');
(p_msg => '# row inserted into xla_acct_prog_events_gt = '||SQL%ROWCOUNT
,p_level => C_LEVEL_EVENT
,p_module => l_log_module);
INSERT INTO xla_evt_class_orders_gt
(event_class_code
,processing_order
)
SELECT xec.event_class_code
, NVL(t.max_level, -1)
FROM xla_event_classes_b xec
, (SELECT application_id, event_class_code, max(LEVEL) AS max_level
FROM (SELECT application_id, event_class_code, prior_event_class_code
FROM xla_event_class_predecs
WHERE application_id = p_application_id
UNION
SELECT application_id, prior_event_class_code, NULL
FROM xla_event_class_predecs
WHERE application_id = p_application_id) xep
CONNECT BY application_id = PRIOR application_id
AND prior_event_class_code = PRIOR event_class_code
GROUP BY application_id, event_class_code) t
WHERE xec.event_class_code = t.event_class_code(+)
AND xec.application_id = t.application_id(+)
AND xec.application_id = p_application_id
AND xec.event_class_code <> 'MANUAL';
(p_msg => 'Number of rows inserted into xla_evt_class_orders_gt = '||SQL%ROWCOUNT
,p_level => C_LEVEL_STATEMENT
,p_module => l_log_module);
SELECT 1
FROM xla_acct_prog_events_gt xap
, xla_events xe
WHERE xe.application_id = p_application_id
AND xe.event_id = xap.event_id
AND NVL(xe.budgetary_control_flag,'N') = DECODE(p_accounting_mode
,'DRAFT','Y' -- 5109240a replace 'D'
,'FINAL','Y' -- 5109240a replace 'F'
,'N')
AND ROWNUM = 1;
INSERT INTO xla_evt_class_orders_gt
(event_class_code
,processing_order
)
SELECT xec.event_class_code
, NVL(t.max_level, -1)
FROM xla_event_classes_b xec
, (SELECT application_id, event_class_code, max(LEVEL) AS max_level
FROM (SELECT application_id, event_class_code, prior_event_class_code
FROM xla_event_class_predecs
WHERE application_id = p_application_id
UNION
SELECT application_id, prior_event_class_code, NULL
FROM xla_event_class_predecs
WHERE application_id = p_application_id) xep
CONNECT BY application_id = PRIOR application_id
AND prior_event_class_code = PRIOR event_class_code
GROUP BY application_id, event_class_code) t
WHERE xec.event_class_code = t.event_class_code(+)
AND xec.application_id = t.application_id(+)
AND xec.application_id = p_application_id
AND xec.event_class_code <> 'MANUAL';
(p_msg => 'Number of rows inserted into xla_evt_class_orders_gt = '||SQL%ROWCOUNT
,p_level => C_LEVEL_STATEMENT
,p_module => l_log_module);
UPDATE xla_acct_prog_events_gt xpa
SET (ledger_id) =
(SELECT ledger_id
FROM xla_events xe
, xla_transaction_entities xte
WHERE xte.application_id = xe.application_id
AND xte.entity_id = xe.entity_id
AND xe.application_id = p_application_id
AND xe.event_id = xpa.event_id);
SELECT count(*) into l_count
FROM xla_acct_prog_events_gt
WHERE ledger_id IS NULL;
select count(*) into l_count from dual
where exists (select 1 from gl_ledger_relationships
where primary_ledger_id = p_ledger_id and hist_conv_status_code = 'RUNNING');