Re: need help with Oracle (for a query)

From: Ray Tomilson <rfjam4_at_hotmail.com>
Date: 5 May 2003 07:09:53 -0700
Message-ID: <40b87de9.0305050609.4c9ba9a7_at_posting.google.com>


"Limner" <ATTENZIONEpend77_at_yahoo.itATTENZIONE> wrote in message news:<ZXqta.91802$iy5.2854423_at_twister2.libero.it>...
> 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

Try this

sql>var vvar varchar2(30);
sql> exec :vvar := 'Pippo|pluto|paperino';

PL/SQL procedure successfully completed.

sql> select length(:vvar)-length(replace(:vvar,'|')) No_Of_particular_character from dual;

NO_OF_PARTICULAR_CHARACTER


                         2
Received on Mon May 05 2003 - 16:09:53 CEST

Original text of this message