MySQL Forums :: General :: Using DECODE with SELECT and LIKE


Advanced Search

Using DECODE with SELECT and LIKE
Posted by: Cookie Le ()
Date: July 10, 2009 01:00AM

I have having problem with the following query:

Select decode(Name,'pass'), decode(Age,'pass') from table1
where lower(decode(name,'pass')) like '%ony%';

firstly, is the above sql syntax correct?
secondly I am NOT getting records with names like 'onya' or 'onyilu'. But I am getting records like 'Antony' or 'Samtony'. If i stripped off lower() and use '=' instead 'like', then it works like it should.

The name field is correctly encoded with 'pass'.
Can someone please explain what is going on here? Thanks.

Options: ReplyQuote


Subject Written By Posted
Using DECODE with SELECT and LIKE Cookie Le 07/10/2009 01:00AM
Re: Using DECODE with SELECT and LIKE Rick James 07/11/2009 01:24PM
Re: Using DECODE with SELECT and LIKE Cookie Le 07/12/2009 06:49PM
Re: Using DECODE with SELECT and LIKE Rick James 07/12/2009 07:08PM
Re: Using DECODE with SELECT and LIKE Cookie Le 07/12/2009 08:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.