If I want to select strings with underscores using Oracle SQL Developer, how do I have to escape those?
I tried:
name like '%_%'
name like '%'_%'
name like '%\_%'
but none of this helped.
You need to use the explicit escape
; in this way you can decide a character to use for escaping and then use it in your LIKE
.
For example, here I use the '!'
to escape special characters:
select str
from (
select 'a_b' str from dual union all
select 'ab' from dual
)
where str like '%!_%' escape '!'
gives
STR
---
a_b