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
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 12 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.