Press "Enter" to skip to content

Find Number of Occurrences of a Character in a String in Oracle

Use Regexp_Count function in Oracle to count the number of occurrences of a string in Oracle using SQL. Below is the example to count the number of occurrences of Comma in a string.

Syntax: RegExp_Count(String, CharacterToFindOccurrences)

SELECT REGEXP_COUNT ('abc, skm, 23, a,,', ',') FROM DUAL

You will get the result 5.

number of occurrences of a character in a string in Oracle