如何计算子字符串并按子字符串分组

时间:2019-07-05 08:25:07

标签: sql oracle group-by substring

我正在尝试计算子字符串,但是失败。我正在使用以下查询:

我尝试了按子字符串方法计数,但是由于以下错误而失败:

inconsistent datatypes: expected - got CLOB
 00932. 00000 -  "inconsistent datatypes: expected %s got %s"
select substr(substr(reponse,INSTR(reponse,'giftType":"')-1),13,1) reponse ,  
       count(*) 
from app_request_log
where uri='/mobile-app'
and user_name='123467654'
and creation_Date >='01-JUL-18'
group by substr(substr(reponse,INSTR(reponse,'giftType":"')-1),13,1) ;

我需要输出为:

reponse count
1         5
2         3
3         9

这是列数据,请记住我无法将值分离到单独的列中

{"eCode":0,"eDesc":"Success","correlationId":"x","errorMessage":null,"giftSeqID":null,"giftEnddate":"0:00:00%2B0200","giftStatus":"2","giftStartdate":"0:00:00%2B0200","giftType":"3"}

0 个答案:

没有答案
相关问题