The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT -1*DECODE(rrs.accounted_dr, NULL, -1*rrs.accounted_cr, rrs.accounted_dr) accounted_amount,
-1*DECODE(rrs.entered_dr, NULL, -1*rrs.entered_cr, rrs.entered_dr ) entered_amount
INTO p_enc_accounted_amount,
p_enc_entered_amount
FROM rcv_receiving_sub_ledger rrs
WHERE rrs.rcv_transaction_id = p_transacton_id
AND DECODE(p_event_type_code, 'PERIOD_END_ACCRUAL', rrs.reference9, p_accounting_event_id) = p_accounting_event_id
AND rrs.accounting_line_type = 'Encumbrance Reversal';
stack_error (l_procedure_name, 'SELECT_RCV_RECEIVING_SUB_LEDGER', p_error_desc);
trace(C_STATE_LEVEL, l_procedure_name, 'ERROR:SELECT_RCV_RECEIVING_SUB_LEDGER:'||p_error_desc);
SELECT -1*mta.base_transaction_value accounted_amount,
-1*NVL(mta.transaction_value, mta.base_transaction_value) entered_amount
INTO p_enc_accounted_amount,
p_enc_entered_amount
FROM mtl_transaction_accounts mta
WHERE mta.transaction_id=p_transacton_id
AND mta.accounting_line_type = 15;
stack_error (l_procedure_name, 'SELECT_MTL_TRANSACTION_ACCOUNTS', p_error_desc);
trace(C_STATE_LEVEL, l_procedure_name, 'ERROR:SELECT_MTL_TRANSACTION_ACCOUNTS:'||p_error_desc);
SELECT event_id,
Line_number,
distribution_identifier
FROM cst_xla_rcv_lines_v
WHERE rcv_accounting_line_type in ('Charge', 'Accrual')
UNION
SELECT event_id,
Line_number,
-1 distribution_identifier
FROM cst_xla_inv_lines_v
WHERE accounting_line_type_code = 5;
SELECT xeg.event_id event_id,
ROW_NUMBER() OVER(PARTITION BY xeg.event_id ORDER BY xeg.event_id) line_number,
DECODE(rrs.accounted_dr, NULL, -1*rrs.accounted_cr, rrs.accounted_dr) accounted_amount,
DECODE(rrs.entered_dr, NULL, -1*rrs.entered_cr, rrs.entered_dr ) entered_amount,
xeg.ledger_id,
xeg.event_type_code,
rae.transaction_date,
pod.budget_account_id budget_account,
rrs.currency_conversion_rate,
rrs.rcv_transaction_id transaction_id,
rrs.accounting_event_id
FROM rcv_receiving_sub_ledger rrs,
xla_events_gt xeg,
rcv_accounting_events rae,
po_distributions_all pod
WHERE c_acct_at_rcpt = 'N'
AND xeg.source_id_int_1 = rrs.rcv_transaction_id
AND xeg.source_id_int_2 = rrs.accounting_event_id
AND xeg.entity_code = 'RCV_ACCOUNTING_EVENTS'
AND rae.accounting_event_id = rrs.accounting_event_id
AND rae.rcv_transaction_id = rrs.rcv_transaction_id
AND xeg.budgetary_control_flag = 'N'
AND xeg.event_id = c_event_id
AND rrs.rcv_sub_ledger_id = c_rcv_sub_ledger_id
AND rrs.accounting_line_type = 'Charge'
AND pod.po_header_id = rae.po_header_id
AND pod.po_line_id = rae.po_line_id
AND pod.line_location_id = rae.po_line_location_id
AND pod.po_distribution_id = rae.po_distribution_id
AND xeg.event_type_code IN ('DELIVER_EXPENSE',
'PERIOD_END_ACCRUAL',
'RETURN_TO_RECEIVING')
UNION
SELECT xeg.event_id event_id,
ROW_NUMBER() OVER(PARTITION BY xeg.event_id ORDER BY xeg.event_id) line_number,
DECODE(rrs.accounted_dr, NULL, rrs.accounted_cr, -1*rrs.accounted_dr) accounted_amount,
DECODE(rrs.entered_dr, NULL, rrs.entered_cr, -1*rrs.entered_dr ) entered_amount,
xeg.ledger_id,
xeg.event_type_code,
rae.transaction_date,
pod.budget_account_id budget_account,
rrs.currency_conversion_rate,
rrs.rcv_transaction_id transaction_id,
rrs.accounting_event_id
FROM rcv_receiving_sub_ledger rrs,
xla_events_gt xeg,
rcv_accounting_events rae,
po_distributions_all pod
WHERE c_acct_at_rcpt = 'Y'
AND xeg.source_id_int_1 = rrs.rcv_transaction_id
AND xeg.source_id_int_2 = rrs.accounting_event_id
AND xeg.entity_code = 'RCV_ACCOUNTING_EVENTS'
AND rae.accounting_event_id = rrs.accounting_event_id
AND rae.rcv_transaction_id = rrs.rcv_transaction_id
AND xeg.budgetary_control_flag = 'N'
AND xeg.event_id = c_event_id
AND rrs.rcv_sub_ledger_id = c_rcv_sub_ledger_id
AND rrs.accounting_line_type = 'Accrual'
AND pod.po_header_id = rae.po_header_id
AND pod.po_line_id = rae.po_line_id
AND pod.line_location_id = rae.po_line_location_id
AND pod.po_distribution_id = rae.po_distribution_id
AND xeg.event_type_code IN ('RECEIVE',
'RETURN_TO_VENDOR')
UNION
SELECT xeg.event_id event_id,
ROW_NUMBER() OVER(PARTITION BY xeg.event_id ORDER BY xeg.event_id) line_number,
-1*mta.base_transaction_value accounted_amount,
-1*NVL(mta.transaction_value, mta.base_transaction_value) entered_amount,
xeg.ledger_id,
xeg.event_type_code,
rt.transaction_date,
pod.budget_account_id budget_account,
rt.currency_conversion_rate,
mmt.transaction_id transaction_id,
-1 accounting_event_id
FROM mtl_material_transactions mmt,
mtl_transaction_accounts mta,
rcv_transactions rt,
xla_events_gt xeg,
po_distributions_all pod
WHERE xeg.source_id_int_1 = mmt.transaction_id
AND mmt.transaction_id = mta.transaction_id
AND rt.transaction_id = mmt.rcv_transaction_id
AND mta.accounting_line_type = 5
AND xeg.entity_code = 'MTL_ACCOUNTING_EVENTS'
AND xeg.budgetary_control_flag = 'Y'
AND xeg.event_id = c_event_id
AND pod.po_header_id = rt.po_header_id
AND pod.po_line_id = rt.po_line_id
AND pod.line_location_id = rt.po_line_location_id
AND pod.po_distribution_id = rt.po_distribution_id
AND xeg.event_type_code IN ('PO_DEL_INV',
'RET_RI_INV')
ORDER BY 1;
INSERT INTO fv_extract_detail_gt VALUES l_fv_extract_detail(l_index);