Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Filter a column on Oracle SQL developer like '%+%'

I want to display all the names in a table that contains the character ‘+’ but it doesn’t work on Oracle SQL developer, while the column contains names with ‘+’

Select *
from Table where NAME like '%+%';

==> I got an empty output

Example:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

Could you help me please ?!

>Solution :

In Oracle, the + character has a special meaning in the LIKE operator, as it represents a single character that can be any character. This means that the %+% pattern in your WHERE clause will match any string that contains a single character between any other characters, but it will not match a + character itself.

To match a + character in a LIKE clause, you will need to escape it using the ESCAPE clause. The ESCAPE clause specifies a character that will be treated as an escape character, allowing you to match the actual + character instead of its special meaning.

Here’s an example of how you can use the ESCAPE clause to match the + character in a LIKE clause:

SELECT * FROM Table WHERE NAME LIKE '%+%' ESCAPE '+';

This will match any string that contains a + character, regardless of its position in the string.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading