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,

You can use 'LIKE' for Character string or variable in

Where clause of Select statement.

Pass the value which needs to be compared into a variable and use that variable in the select statement.

Example:

Data: v_ltext like cskt-ltext value 'abc%abc'.

Select * from CSKT

Into table itab

where ltext like v_ltext.

Regards,

Sudhakar.