Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: character count in a string
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