Niraj Patel
Niraj Patel

Reputation: 115

how to search camel case data in oracle database search query?

this is my search query

Below search query returns products Because 'iPhone' is case sensitive

SELECT productname,id FROM products where productname LIKE '%iPhone%'

Below search query returns ZERO products Because 'iPhone' is case sensitive

SELECT productname,id FROM products where productname LIKE 'IPHONE%' or  productname LIKE '%iphone%'

If i used UPPER or LOWER function it returns zero, so how can I solve this issue ?

How Can I solve camel case sensitive data in oracle database query. I can not change the product name in database. Anyone have solution for this ? If you have doubt in my question please ask me I will instant reply

Upvotes: 0

Views: 95

Answers (1)

Littlefoot
Littlefoot

Reputation: 143088

SELECT productname, id 
FROM products 
WHERE LOWER(productname) LIKE LOWER('%iPhone%')

should return something. Note LOWER function on both sides of LIKE.

Upvotes: 1

Related Questions