Reputation: 25
I'm using Oracle and I'm trying to filter part of the text of a string. For example, I want to get when in a text there is 'Credit Note' what happens is that there are values like "Generate Credit Note Manually".
In SQL Server I know it works using:
Select Column1
From Table1
Where Column1 LIKE '% Credit% Note%'
But I don't get the above in Oracle, does not return any match with "Generate Credit Note Manually".
Any suggestions?
Upvotes: 1
Views: 1528
Reputation: 66
The syntax you're using is correct.
If the query isn't returning the data there might be something wrong with the data. I know it might look like plain text but sometimes there are invisible encoding along with it, especially if it was copy-pasted from a heavy word processor like MS Word or something.
Create additional rows and write the text manually to make sure there are no encoding being copied. Also, try copy-pasting the value from the table into notepad, see it pastes some additional symbols. Also, check to see if it's a case-sensitivity issue.
Upvotes: 3
Reputation: 11
SELECT Column1
From Table1
Where Column1 LIKE '%Credit Note%'
You don't have to add %
to represent the white space. The like
operator can take in string and white spaces when you wrap them up in this way 'text to search'
.
Upvotes: 0
Reputation: 25
You can use this:
Select Column1
From Table1
Where Column1 LIKE '%Credit%'
or Column1 LIKE '%Note%'
If you need matching these words together try to use REGEXP_LIKE()
Upvotes: 0