Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DECODE with Wild Card Characters ???

549147Nov 30 2006 — edited Nov 30 2006
Hi,

My scenario is that I want to put 'Y' in my result set whereever the column value matches 'B25A' , 'B25B' , 'B25C' except 'B25D'.

I can use DECODE(columnValue, 'B25A' , 'Y' , 'B25B' , 'Y' , 'B25C' , 'Y' , 'N')

This works fine... but if there are 50 values like this ... I cant really go on writing the decode options, for each of them... Since all of them have a common characteristic that they contain '25', I was trying to use '%25%' within Decode...

But it doesnt work ! .... I think as expected, it considers '%' as a character and looks for that instead of a wildcard search...

Along with this, it should take care of the exception case - B25D.

Please suggest.

Thanks...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2006
Added on Nov 30 2006
19 comments
3,674 views