Bitte auf english die folgende Reconciliation der Buchungen Beschreiben für die Wiki Dokumentation:
WITH il_recon_src AS (
code
SELECT
tl.tech_supply_id,
tl.tech_log_id,
t.fiscal_period,
t.tech_period_lock,
count(*) AS src_count,
sum(transaction_currency_amount) AS src_sum
FROM
DEV_GAD_DB.TRANSITION_LAYER.TL_GERAS_PREMIUM AS tl
INNER JOIN DEV_GAD_DB.TECH_UTIL.TU_SUPPLY_IDS_CURRENT_STATUS AS t
ON
t.tech_source_system = 'GERAS_PREMIUM'
AND t.tech_status = 3010
AND tl.tech_supply_id = t.tech_supply_id
GROUP BY tl.tech_supply_id, tl.tech_log_id, t.fiscal_period, t.tech_period_lock
),
il_recon_tar AS (
code
SELECT
b.tech_supply_id,
b.tech_log_id,
t.fiscal_period,
count(*) AS tar_count,
sum(transaction_currency_amount) AS tar_sum
FROM DEV_GAD_DB.INTEGRATION_LAYER.TMP_IL_GERAS_PREMIUM_BASE AS b
INNER JOIN DEV_GAD_DB.TECH_UTIL.TU_SUPPLY_IDS_CURRENT_STATUS AS t
ON
t.tech_source_system = 'GERAS_PREMIUM'
AND t.tech_status = 3010
AND b.tech_supply_id = t.tech_supply_id
GROUP BY b.tech_supply_id, b.tech_log_id, t.fiscal_period
),
recon_il_joined AS (
code
SELECT
src.tech_supply_id,
src.tech_log_id,
src.fiscal_period,
src.tech_period_lock,
src.src_count,
src.src_sum,
tar.tar_count,
tar.tar_sum
FROM il_recon_src AS src
LEFT JOIN il_recon_tar AS tar
ON src.tech_supply_id = tar.tech_supply_id
),
dqm_reconcile AS (
code
SELECT
tech_supply_id,
tech_log_id,
fiscal_period,
tech_period_lock,
src_count,
src_sum,
tar_count,
tar_sum,
CASE
WHEN src_count = tar_count
THEN 100
ELSE -1
END AS row_num_qs,
CASE
WHEN src_sum = tar_sum
THEN 100
ELSE -1
END AS amount_qs,
least(row_num_qs, amount_qs) as total_qs,
CASE
WHEN total_qs = 100
THEN 3100
ELSE 3099
END AS tech_status
FROM recon_il_joined
ORDER BY 1
),
final as (
code
SELECT
TECH_UTIL.SEQ_RECON.nextval as tech_recon_id,
tech_supply_id,
tech_log_id,
'GERAS_PREMIUM' as tech_source_system,
fiscal_period,
tech_status,
current_timestamp() as tech_inserted_at_ts,
null as tech_delete_flag,
null as tech_calculation_type,
tech_period_lock,
src_count,
src_sum,
tar_count,
tar_sum,
row_num_qs ,
amount_qs ,
total_qs
FROM dqm_reconcile
)
SELECT * FROM final
Assistant
Reconciliation Process for GERAS_PREMIUM Transactions
(Data Quality Management for Transition to Integration Layer)
Purpose
This SQL workflow ensures data integrity by reconciling transaction counts and amounts between the TRANSITION_LAYER (source) and INTEGRATION_LAYER (target). It verifies that all GERAS_PREMIUM transactions are accurately migrated, with matching record counts and monetary sums between the two layers. This is critical for maintaining consistency in financial reporting and audit trails.
Key Process Steps
1. Source Data Extraction (il_recon_src)
Source:TRANSITION_LAYER.TL_GERAS_PREMIUM
Filter Criteria:
Joined with TECH_UTIL.TU_SUPPLY_IDS_CURRENT_STATUS where:
tech_source_system = 'GERAS_PREMIUM'
tech_status = 3010 (indicating "processed" or "completed" status)
Aggregation:
Groups by tech_supply_id, tech_log_id, fiscal_period, and tech_period_lock.
Computes:
src_count: Total records per group.
src_sum: Total transaction amount in the source currency.