Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: counting number of times in strings
Maurice Samuels wrote:
>
> does anyone out there know of any oracle supplied functions (pl/sql) that
> will count the number of times a character appears in a strings?
> for example,
> string='0011223344'
>
> the function would return 2 if i asked how many times '0' appears in the string.
> thanks in advance
> -maurice
> samuels_at_seas.upenn.edu
A cute trick...
take the difference between
length(string) and
length(replace(string,search_string,null))
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Tue Jul 11 2000 - 00:00:00 CDT
![]() |
![]() |