Skip to Content
0
Dec 04, 2007 at 10:34 AM

dynamic where clause in select query

140 Views

Hi

I'm trying for a dynamic query and in the dynamic where clause i'm checking a field for constant.....for instance if i wanna to use WERKS EQ '0478' how to declare it in dync where clause. i tried for the following:

SELECT (TAB_FIELD) INTO TABLE DITAB UP TO 10 ROWS FROM (TAB_NAME) WHERE (CONDI).

heree CONDI = 'werks eq 0287' . in this case the query fails as the werks shud be equal to '0287' and not just 0287. How to handle this? i tried for the following

CONDI = 'werks eq " '0287' " ' but no luck as it is not a valid stmt as i knew.