Use this sql select to count a special character inside a column or string:
Column selection:
String selection
Watch this thread on Ask Tom: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:55423584511523
Column selection:
select col, length(col)-length(replace(col,',',''))
from
(select 'col1,col2,col3,col4' as col from dual);
COL LENGTH(COL)-LENGTH(REPLACE(COL,',',''))
------------------- ---------------------------------------
col1,col2,col3,col4 3
String selection
BEGIN
:P1_STRING := 'col1,col2,col3,col4';
select length(:P1_STRING)-length(replace(:P1_STRING,',','')) into :P1_CHAR_CNT from dual;
END;
Watch this thread on Ask Tom: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:55423584511523