Link to home
Start Free TrialLog in
Avatar of d27m11y d27m11y
d27m11y d27m11yFlag for United States of America

asked on

No. of occurences in oracle


I have a string 'aabbbccc''

Now, I wanted to find out how many 'a' are there in this string.. Can someone guide me?

Quick response is appreciated!
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Since the third parameter of regexp_replace defaults to null, you can further simplify mrjoltcola's expression to
select length(regexp_replace('aabbbaccc', '[^a]')) from dual;
Avatar of d27m11y d27m11y

ASKER

Easy to follow!