Search string for whole words in Oracle
Posted on 2011-02-22
I am looking for the most simple and down-to-earth formulation of an SQL search query for whole words in a stored string field.
The input will be a single word, e.g. 'foo'. And the string stored in the DB will be a semicolon-delimited string that might contain the single search word.
How should I write the SQL so that I will get a hit if the field looks like
'foo; foo1; foo2'
...but NO hit if the field looks like
Obviously, this won't work:
WHERE thesemicolonstring LIKE '%foo%'
...since that will get me a hit in both cases.