Skip to Content
0
Jan 13, 2017 at 05:38 PM

Dynamic WHERE Clause in SAP HANA Calculated view

3397 Views

Hello Everyone,

I am trying to create a simple scripted calculated view which does the following:

1. Created an Input parameter for accepting the WHERE Clause for the SQL query

2. Get the count of records from a big view/table based on the input query. I am trying the following options, but none of them work.

var_out = SELECT COUNT(*) AS REC_COUNT FROM ZTEST_TABLE where (:lv_whereclause);

or

var_out = SELECT COUNT(*) AS REC_COUNT FROM (:lv_whereclause);

or

lt_out = SELECT COUNT(*) AS REC_COUNT FROM ZTEST_TABLE

var_out = apply_filter(:lt_out,:lv_whereclause);

Can any one help me to resolve the issue?