The lack of this function forced me to come up with a quick and dirty solution:
select
:str as "string",
:chr as "character",
length(:str) - length(translate(:str,chr(0)||:chr,chr(0))) as "count"
from dual;
| string | character | count |
|---|---|---|
| AB^CDE^FGHI^JK^^LMNOPQ^RST^UVWX^YZ | ^ | 8 |
Note: this works on the assumption that you are never going to count character zero.
Anyone else with a better/faster idea?