Hi folks,
I have a calculation view where I'm building an array and at the end I unnest and bind to my var_out.
Something like this;
VAR_OUT = UNNEST(:SCARR_COMPCODE,:SCARR_DOCNUM,:SCARR_CUSTOMER, :SCARR_PROFIT_CTR, :SCARR_AMT) AS ("COMPCODE","DOCNUM","CUSTOMER", "PROFIT_CTR", "AMOUNT");
Now what I'd like to do is I would like to join some other tables to this unnested array so I figured I would do something like;
tempVar = UNNEST(:SCARR_COMPCODE,:SCARR_DOCNUM,:SCARR_CUSTOMER, :SCARR_PROFIT_CTR, :SCARR_AMT) AS ("COMPCODE","DOCNUM","CUSTOMER", "PROFIT_CTR", "AMOUNT");
VAR_OUT = select * from tempVar inner join table abc on condition...
But the binding of tempVar is failing and I'm getting error 'could not find table tempVar in schema SYSTEM.' Normally i'm binding table variables like this all the time like this;
tempVar = select * from TABLE1
In this case HANA automatically knows it's a table variable. Yet for some reason the UNNEST is not automatically considered a tableVar yet looking at the SQL guide it says the output of UNNEST is a table specification (<return_table_specification>).
Is this not possible to do what I'm attempting or do I somehow have to manually declare tempVar as a table variable when using unnest?
Thanks,
-Patrick