Re: professional question

From: DanHW <danhw_at_aol.com>
Date: 12 Apr 1999 01:01:32 GMT
Message-ID: <19990411210132.16128.00001776_at_ng-ft1.aol.com>


>how to substitute the case-statement in MS-SQL Server syntax in ORACLE
>
>for example:
>SELECT RefURL=MAX( CASE WHEN CHARINDEX('?', Referer) > 5 THEN
> SUBSTRING(Referer, 1, CHARINDEX('?', Referer) - 1
> ELSE Referer
> END
> )
>FROM SESSIONS;
>
>TIA
>

Try the decode statement...

select decode(x,1,'One',2,'Two','Anything Else') from xyz

If X=1, the text string 'One' is returned, if X=2,the string 'Two' is returned.  The last string is the 'case otherwise' retrun value. There is no (reasonable) limit to how many values you can use in the decode, and you can nest them up to 20 levels deep)

Dan Hekimian-Williams Received on Mon Apr 12 1999 - 03:01:32 CEST

Original text of this message