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

Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.in and orclqa.com a question and answer forum for developers.

Leave a Reply