Re: find out how many times particular character occur in given string.

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Thu, 11 Dec 2008 18:50:49 -0600
Message-ID: <Uzi0l.9728$yr3.6124@nlpi068.nbdc.sbc.com>


Mladen Gogala wrote:

> "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> 

>> SQL> def str='A*B*C*D'
>> SQL> /
>> NB
>> ----------
>> 3
>>
>> 1 row selected.
>>
>> SQL> def str='A'
>> SQL> /
>> NB
>> ----------
>> 0
>>
>> 1 row selected.
>>
>> Regards
>> Michel
> 
> Michel, didn't you get things a bit wrong here? The string 'A*B*C*D'
> contains at least 0.873516 occurrences of the letter 'A'. Your result
> is zero, which would mean "no occurrences". Please, allow me to send this
> to the Oracle Daily WTF.

Mladen,

think you missed something there in the post... look at it more closely... There are two queries - not one. First one finds there are 3 '*'. The second finds 0 '*'. Received on Thu Dec 11 2008 - 18:50:49 CST

Original text of this message