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 Holger,

1. Just a slight change in sql

2. Instead of hardcode ther where condition with LIKE statement we have to CONSTRUCT the whole condition

in a variable and use.

3. WHERE (source_text)

source_text is a variable -- maybe (100) type c.

4. Just consturct the source_text

using CONCATENATE

so that it contains

key1 like '%ABC'.

5. It will work.

6. Make proper use of concatenate and variable

and proper Quotes '

otherwise sql at runtime will give error.

Regards,

Amit M.