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: Help please with Oracle

Re: Help please with Oracle

From: Oleg Fedorov <ofedorov_at_purdue.edu>
Date: Mon, 5 May 2003 10:44:27 -0500
Message-ID: <b960su$mg8$1@mozo.cc.purdue.edu>


Function My_Count(p_string varchar2,p_character char) return number is begin
  return LENGTH(p_string||'.')-LENGTH(REPLACE(p_string||'.',p_character)); end;

"Guido Konsolke" <Guido.Konsolke_at_triaton.com> wrote in message news:1052133780.672728_at_news.thyssen.com...
> "Limner" wrote...
> >
> > Hi to all
> >
> > i've a question.
> > I need to know how to count how many times it present a particular
> caracter
> > in a varchar2 field ( i've oracle 9i )
> >
> > For example: " Pippo|pluto|paperino" and i want to know how many
> times
> > is present the caracter "|" ( 2 times )
> >
> > can someone help me in this ??
> >
> > Thanks in advance
> >
> > Danilo
> >
> Hi Danilo,
>
> until someone offers a better solution, here's an ugly one:
> you have to eliminate all characters that are not '|'. This can be done
> by using the REPLCAE function. You will need to provide *every* character
> that *might* occur. Step 2 is to wrap this monster with the LENGTH()
> function.
>
> hth and someone does better,
>
> Guido
>
>
Received on Mon May 05 2003 - 10:44:27 CDT

Original text of this message

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