This content has been marked as final. Show 3 replies
It sounds like you want this condition:
where substr(<your_column>,4,1) = '-'
How to write SQL query to select the name whose 4th character is _
You can use a LIKE expression if you escape the underscore for the 4th character
See Aman's answer in this recent thread.
select * from emp where job like '___/_%' escape '/';
Re: Bit Confusion
Using LIKE or SUBSTR won't allow any index on that column to be used.
I would use SUBSTR, as shown in the previous reply.
If you want to use LIKE, you have to "escape" the literal underscore, like this
That's 3 uderscores before the '\'.
WHERE str LIKE '___\_%' ESCAPE '\'