Can you tell me how can I count number of specific character in a string? i.e. I want to count no. of ',' in this string '12.5,44.7,400.25,8.5'. Syntax please.
Printable View
Can you tell me how can I count number of specific character in a string? i.e. I want to count no. of ',' in this string '12.5,44.7,400.25,8.5'. Syntax please.
See SUBSTR builtin function syntax.
http://www.dbasupport.com/forums/sho...?threadid=6430
Well, using SUBSTR alone can hardly ever give you any usable result with this problem ;).
TRANSLATE seems more appropriate. From your example I conclued you only have numerics, comma and decimal point and space characters in your strings. If so, you can use the following:
SELECT LENGTH(TRIM(TRANSLATE('12.5,44.7,400.25,8.5', ',.0123456789', ','))) FROM dual;
It will return you the number of commas in your string.