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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Partial string comparison in DECODE ?

Re: Partial string comparison in DECODE ?

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 19 Oct 1999 20:10:03 +0200
Message-ID: <940356625.20407.0.pluto.d4ee154e@news.demon.nl>


A bit ugly, but you could try to use the replace function replace(substr(dept_nbr,1,4), 'T791','XXXX') = 'XXXX'

Hth,

--
Sybrand Bakker, Oracle DBA
TurkBear <johng_at_mm.com> wrote in message news:380c8dbe.6893692_at_super.news-ituk.to...
> I am trying to create a DECODE statement to replicate some formulas I
developed
> in Crystal reports,( I want to create a view that includes the resulting
values)
> so I need to create a DECODE statement that is equivalent to:
>
> if dept_nbr like 'T791%' then 'Management' else if
> dept_nbr like 'T792%' then 'Second Level' else if
> dept_nbr like 'T7922%' then 'Second_sub Level2' .....etc
> ( These are examples, not real , so ignore logic )
> In other words, the 'comparison part' may be the first 2 or 3 or 4 or 5 or
6
> characters in the field...
>
> It appears that wild cards are not allowed in the DECODE expression, so
any
> ideas ?
>
>
> Thanks,
>
> John Greco
>
> PS: ( Oracle 7.3.4, Netware 4.11,)
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==----- Received on Tue Oct 19 1999 - 13:10:03 CDT

Original text of this message

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