cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I would like to use a SQL stmts like this:

SELECT * FROM tab WHERE key1 LIKE '%<i>variable</i>%'.

Using LIKE in the WHERE clause requieres a character field. But I want to use a vairable...

how should i write that?

thx,

holger

0 Likes
View Entire Topic
Former Member
0 Likes

hi,

data str(100).

data val type i.

now you can dynamically set the value for str..like-->

case flag.

when '1'.

val = value for flag 1.

str = concatenate 'key1 eq ' val into str.

when '2'.

val = value for flag 1.

str = concatenate 'key1 eq ' val into str.

endcase.

SELECT * FROM tab WHERE str.

i hope it will solve your problem.

Message was edited by: Anid