cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HANA SQL WHERE Clause using variable as fieldname

0 Likes
2,389

I am trying to build a SQL query on a table where I use a variable for the table fieldname in teh where clause e.g,

var1 VARCHAR(10) ;

var1 := '"FIELD1"';

select * from TABLE1 where :var1 = 'X' ;

It's not recognising var1 as FIELD1 from TABLE1, can anyone help?

View Entire Topic
0 Likes

FYI, I managed to solve this. For anyone looking at this post for an answer, I used an APPLY_FILTER

example..

--lv_whereclause = ':ZZBLKRSNT = ''X''';

lt_result = APPLY_FILTER(ZTEST_TABLE, :lv_whereclause);