Reputation: 3
I'm trying to run a query where the charlist wildcard
is defined in the middle of the string as follows:
SELECT * FROM table WHERE key LIKE 'A___[AB]________',
and of course it doesn't work. Here I want to query for 13 letters string which consists of 'A' at the beginning, and 'A' or 'B' at the 6th place. I do not want to use the keyword "OR"
for this search since later I have to run more complicated queries, and I want to keep it simple.
Any suggestions?
Upvotes: 0
Views: 968
Reputation: 4053
LIKE
does not understand regular expresions in Oracle. use REGEXP_LIKE
instead. http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions018.htm
your regexp should look like this '^A.{4}[AB].{7}$'
Upvotes: 1