WHERE SUBSTR(NAME, 1, 1) LIKE IN ('k', 'l', 'b')
If I use this code, I get an error
ORA-00936: missing expression
There seems to be no error logically, but I am wondering which part of the code above is wrong.
I’m also curious about a way to replace LIKE IN
.
Advertisement
Answer
Removing LIKE
from your current WHERE
clause leaves it valid:
WHERE SUBSTR(NAME, 1, 1) IN ('k', 'l', 'b')
It isn’t clear from what you posted alone above why you think you need LIKE
here. If you wanted to express the above logic using LIKE
, you could use:
WHERE NAME LIKE 'k%' OR NAME LIKE 'l%' OR NAME LIKE 'b%'
Note that if your version of SQL supports regex like, you could also use the regex pattern ^[klb]
.