Skip to Content
-1

Can we use CTE in a table functions in HANA?

Hi Experts,

I just want to know, can we use CTE in a Table Functions in HANA?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 03 at 01:55 PM

    Hello,

    Not CTE expression but you can assing the SELECT statement output to a table variable and then return that variable as follows

    cte =    select 
         vbeln
       from "SAPABAP1"."VBAK"
       where 
         vbeln between :minV and :maxV;
    return :cte;
    

    You can place above code as the body of the table function where CTE select list maps to the columns of the returning table structure

    Add comment
    10|10000 characters needed characters exceeded