Read from a SQL Curve directly
search cancel

Read from a SQL Curve directly

book

Article ID: 385044

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

Is there a sample SQL Query that shows how data can be read from a SQL Curve column directly?

Resolution

The following sample reads from odf_nk_cost SQL Curve column, of table fin_cost_plan_details.

SELECT
    ii.name,
    fp.name,
    t1.start_date,
    t2.finish_date,
    s.segment_sum
FROM
    fin_cost_plan_details f
    CROSS JOIN nk_segments_fct(odf_nk_cost) s
    JOIN table(
        CRV_CALENDAR_FCT(
            'MONTH',
            to_date('2024-01-01', 'yyyy-mm-dd'),
            null,
            12,
            'DEFAULT',
            ''
        )
    ) t1 ON s.segment_start = t1.julian_start
    JOIN table(
        CRV_CALENDAR_FCT(
            'MONTH',
            to_date('2024-01-01', 'yyyy-mm-dd'),
            null,
            12,
            'DEFAULT',
            ''
        )
    ) t2 ON s.segment_finish = t2.julian_finish
    JOIN fin_plans fp ON fp.id = f.plan_id
    JOIN inv_investments ii ON ii.id = fp.object_id
ORDER BY
    f.last_updated_date DESC;