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: character count in a string

Re: character count in a string

From: Anurag Varma <avoracle_at_gmail.com>
Date: 23 Jan 2007 07:45:12 -0800
Message-ID: <1169567112.290605.240990@m58g2000cwm.googlegroups.com>

Eitan M wrote:
> Hello,
> how can I get a specific character count in a string
> (
> i.e : string is 56222, and I am looking for '2' occurance
> when i do :
> select charcount('56222') should return : 3
> )
>
> Thanks :)

ORA92> select length('56222') - length(replace('56222','2')) from dual;

LENGTH('56222')-LENGTH(REPLACE


                             3

10GR2> select length(regexp_replace('56222','[^2]','')) from dual;

LENGTH(REGEXP_REPLACE('56222','[^2]',''))


                                        3


Anurag Received on Tue Jan 23 2007 - 09:45:12 CST

Original text of this message

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