I have query that I run on Oracle that is supposed to allow hyphen characters. The results are supposed to match the exact String including the hyphen character as follows:
SELECT <field>
FROM <table>
WHERE LOWER(field) LIKE '%-pa%';
The results however show "web-page", "web -page" as well as "web page". However, I only would like to find "web-page" and "web -page" in this case. I tried to escape the hyphen character with a backslash but that results in no records found. Can anybody give me a hint on how to make this work?
That's not my observation of how Oracle treats hyphens. Here's a brief sample of what I see:
Are you sure you're not using the underscore instead of the hyphen? The underscore is a single character wild card.
Normaly the hyphen shouldn't need to be escaped, but you can try
instead of 'X', you can use any arbitrary character