Say there is a variable
v_Source := 'stack#over#flo#w';
How to get the number of occurrences of '#
' in it in a single 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With