Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> anyone way to use a wildcard in a decode?

anyone way to use a wildcard in a decode?

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Thu, 12 Jun 2003 13:11:46 +0100
Message-ID: <E2F6A70FE45242488C865C3BC1245DA703C7990F@lnewton.leeds.lfs.co.uk>


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.



Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar_at_LFS.co.uk
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US