cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic select statements

0 Kudos

Hello,

It is not possible to use dynamic sql inside READ ONLY  procedures in hana to avoid side effects.

But nothing is proposed when the dynamic statement is guaranteed to be a single select statement.

I'm aware of APPLY_FILTER but unfortunalty it doesn't support subqueries or joins...

And I would like to filter on values currently in the system, either  with IN..SELECT predicate or using joins

Exemple:

SELECT ACCOUNT,CATEGORY,

FROM FACT_TABLE

WHERE ACCOUNT IN (select ID from <SESSION_USER_DEPENDANT_VIEW>)

The above IN predicate can be replace by an inner join :

SELECT ACCOUNT,CATEGORY,

FROM FACT_TABLE T, <SESSION_USER_DEPENDANT_VIEW> V

WHERE T.ACCOUNT = V.ID;

Im quite stuck

Is their any workarounds possible, using calculation engine functions or something else??

Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182114
Active Contributor
0 Kudos

Hi Alexandre,

Is an option to you use one single table to hold data from all users, maybe isolated by session id?


Another possibility is to you create another procedure spliting the logic between than and leting the dynamic code outside the main procedure where should receive the data as IN parameter.


Give more details about this <SESSION_USER_DEPENDANT_VIEW>. What is the goal of it?


Regards, Fernando Da Rós