Kannst du bitte folgende Abfrage Beschreiben und evtl. Verbesserungen vorschlagen:

WITH final AS (
    SELECT
 
        integration_layer.seq_tech_record_il_id.nextval AS tech_record_il_id,
        --UUID_STRING() as TECH_RECORD_IL_ID,
        tech_record_tl_id,
        tech_record_sl_id,
        tl.tech_supply_id,
        tl.tech_supply_id AS tech_supply_id_orig,
        cast(tl.tech_log_id AS STRING) AS tech_log_id,
        tl.tech_run_id,
        tl.tech_source_system,
        tech_load_dt,
        current_timestamp() AS tech_change_dt,
        posting_date,
        to_varchar(tl.fiscal_period) AS fiscal_period,
        posting_date_orig,
        legal_entity,
        tl.sub_legal_entity,
        sub_legal_entity_old,
        nature_of_business,
        underwriting_type,
        underwriting_year,
        value_type,
        billing_date_from,
        billing_date_to,
        due_date,
        cost_center,
        entry_time_of_claim,
        claim_notification_year_month,
        tl.booking_code,
        tl.booking_code_class,
        --FLOW_TYPE,
        transaction_currency,
        round(transaction_currency_amount, 2) AS transaction_currency_amount,
    'EUR' as FUNCTIONAL_CURRENCY,
    lcur.LOCAL_CURRENCY as LOCAL_CURRENCY,
    ROUND((nvl(TRANSACTION_CURRENCY_AMOUNT,0) / fc.CONV_RATE), 2) as FUNCTIONAL_CURRENCY_AMOUNT,
    ROUND((nvl(FUNCTIONAL_CURRENCY_AMOUNT,0) * lc.CONV_RATE), 2) as LOCAL_CURRENCY_AMOUNT
,
        ri_form,
        ri_nature_of_treaty,
        ri_type,
        ri_char,
        segment_lob,
        internal_key,
        segment_cob,
        segment_hgb,
        segment_actuarial,
        segment_co,
        segment_gaap,
        tax_country,
        risk_country,
        residence_country,
        contract_country,
        partner_payment,
        partner_company,
        led.ledger_hgb,
        led.ledger_ifrs17
 
    FROM DEV_GAD_DB.TRANSITION_LAYER.TL_GERAS_PREMIUM AS tl

 
    LEFT JOIN ( select  SUB_LEGAL_ENTITY, LOCAL_CURRENCY, VALID_FROM, VALID_TO
                from    DEV_GAD_DB.MASTER_DATA.MD_SUB_LEGAL_ENTITY
                ) lcur 
    on  tl.SUB_LEGAL_ENTITY = lcur.SUB_LEGAL_ENTITY                                  and
        TO_DATE(tl.FISCAL_PERIOD, 'YYYYMM') between lcur.VALID_FROM and lcur.VALID_TO
    LEFT JOIN ( select   BOOKING_CODE, LEDGER_HGB, LEDGER_IFRS17, CURRENCY_FLAG, VALID_FROM, VALID_TO 
                from DEV_GAD_DB.MASTER_DATA.MD_BOOKING_CODE
                where   LEDGER_HGB = 'X' or LEDGER_IFRS17 = 'X' 
                        ) led
    ON          tl.BOOKING_CODE = led.BOOKING_CODE and
                TO_DATE(tl.FISCAL_PERIOD, 'YYYYMM') between led.VALID_FROM and led.VALID_TO
    LEFT JOIN (SELECT distinct SOURCE_CURRENCY, "CONV_RATE_EUR" as CONV_RATE, TO_DATE(FISCAL_PERIOD||'01','YYYYMMDD') as CONV_DATE , CURRENCY_FLAG
               FROM DEV_GAD_DB.MASTER_DATA.V_CURRENCY_RATES ) fc
    ON  tl.TRANSACTION_CURRENCY = fc.SOURCE_CURRENCY  
    and tl.POSTING_DATE = fc.CONV_DATE  
    and fc.CURRENCY_FLAG = nvl(led.CURRENCY_FLAG,'U')
    LEFT JOIN (SELECT distinct SOURCE_CURRENCY, "CONV_RATE_EUR" as CONV_RATE, TO_DATE(FISCAL_PERIOD||'01','YYYYMMDD') as CONV_DATE , CURRENCY_FLAG 
               FROM DEV_GAD_DB.MASTER_DATA.V_CURRENCY_RATES ) lc
    ON  LOCAL_CURRENCY = lc.SOURCE_CURRENCY 
    and tl.POSTING_DATE = lc.CONV_DATE
    and lc.CURRENCY_FLAG = nvl(led.CURRENCY_FLAG,'U')

 
 
    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 = 3000
            AND tl.tech_supply_id = t.tech_supply_id
 
 
)
 
SELECT *
FROM final