Finding the count of characters and numbers in a string

前端 未结 2 1518
-上瘾入骨i
-上瘾入骨i 2020-12-05 16:22

Hi I have a table test as below

NAME
---------
abc1234
XYZ12789
a12X8b78Y9c5Z

I try to find out the count of number of numbers and characte

2条回答
  •  佛祖请我去吃肉
    2020-12-05 17:27

    @alfasin answer is good, but if you're using 11g then it can get simpler:

    select name,
    REGEXP_count(name,'\d') as num_count,
    REGEXP_count(name,'[a-zA-Z]') as char_count,
    from test6;
    

提交回复
热议问题