Skip to content
Advertisement

Use string contains function in oracle SQL query

I’m using an Oracle database and I want to know how can I find rows in a varchar type column where the values of that column has a string which contains some character.

I’m trying something like this (that’s a simple example of what I want), but it doesn’t work:

I also want to know if I can use a function like chr(1234) where 1234 is an ASCII code instead of the 'A' character in my example query, because in my case I want to search in my database values where the name of a person contains the character with 8211 as ASCII code.

With the query select CHR(8211) from dual; I get the special character that I want.

Example:

Advertisement

Answer

By lines I assume you mean rows in the table person. What you’re looking for is:

The above is case sensitive. For a case insensitive search, you can do:

For the special character, you can do:

The LIKE operator matches a pattern. The syntax of this command is described in detail in the Oracle documentation. You will mostly use the % sign as it means match zero or more characters.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement