Say there is a variable
v_Source := 'stack#over#flo#w';
How to get the number of occurrences ' #' in it in one SQL query?
#
select length('stack#over#flo#w') - length(replace('stack#over#flo#w','#',null)) from dual;
From oracle 11 you can use REGEXP_COUNT
select REGEXP_COUNT('stack#over#flo#w', '#') from dual;
SELECT REGEXP_COUNT( 'stack#over#flo#w', '#' ) FROM DUAL