MySQL Forums
Forum List  »  General

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
July 10, 2009 01:00AM


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.