Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: I want to know how many times comma(,) appear in string ...
Yann Chevriaux solution is ok and probably works fine but there is a much
simpler way
Create or replace Function Num_Occurences(vString in varchar2, vSearchString
in varchar2)
return number as
nNum number := 0;
begin
nNum := length(vString) - length(replace(vString, vSearchString,''));
return nNum;
end;
SQL> select num_occurences('A,B,C,D,E,F',',') from dual;
NUM_OCCURENCES('A,B,C,D,E,F',',')
5
HTH Mark
ÃÖ»ó¼ø <topgun_at_freeway.co.kr> wrote in message
news:twFH3.606$Lg2.27813_at_news2.bora.net...
> I want to know the count of the string or character
>
> as follows .
>
> Given,
> ls_string = '1253,5678,ascd,!@#er, 5896, @@@;';
>
>
> How many times appear comma(,) in the string 'ls_string' ?
>
> The result : The comma(,) appears five times in the 'ls_string' .
>
> Is there any function or other way to resolve this problem ?
>
> We use Oracle 7.3.3.3.
>
> Thanks in Advance .
>
>
>
Received on Mon Sep 27 1999 - 09:18:19 CDT
![]() |
![]() |