0

I'm trying to count substring but it fails. I am using the below query:

I tried the count by sub string method, but it failed with the below error:

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) ;

I need the output to be like:

reponse count
1         5
2         3
3         9

This is the column data, bearing in mind that I can't separate value into separate columns:

{"eCode":0,"eDesc":"Success","correlationId":"x","errorMessage":null,"giftSeqID":null,"giftEnddate":"0:00:00%2B0200","giftStatus":"2","giftStartdate":"0:00:00%2B0200","giftType":"3"}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0