Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> anyone way to use a wildcard in a decode?
Hi Ryan,
DECODE(expression, value_1, result_1, ....., default result)
so :
if the expression "instr(y,'A')" returns zero, do a BLAH else do an XXXX. The problem is 'the wrong way round' because you only know that zero means 'not present in string' and any other result means 'present in string'. So if A is not present in the string, do BLAH otherwise do XXXX. See ?
Cheers,
Norman.
Tel: 0113 289 6265 Fax: 0113 289 3146 URL: http://www.Lynx-FS.com
-------------------------------------
-----Original Message-----
From: rgaffuri_at_cox.net (Ryan Gaffuri) [mailto:rgaffuri_at_cox.net]
Posted At: Thursday, June 12, 2003 12:36 PM
Posted To: server
Conversation: anyone way to use a wildcard in a decode?
Subject: Re: anyone way to use a wildcard in a decode?
thanks
select decode(instr(y,'A'),0,'BLAH','XXXX') from xx;
I dont quite follow the syntax. Why is there a '0'? Also I would think that 'XXXX' would be the 'else' and the 'BLAH' would be the then.
So if pattern 'A' exists then 'BLAH' else 'XXXX', but it seems to be the other way around? Received on Thu Jun 12 2003 - 07:11:46 CDT