标签:from nbsp 内容 ica when div weight ase class
json字符串的内容如下:
[{"stockName":"阳光照明","stockProfit":"5500.0000","stockCode":"600261"},{"stockName":"京 运 通","stockProfit":"6664.5000","stockCode":"601908"}]
通过regexp_substr和regexp_instr函数来提取stockcode字段值,返回前3个值。SQL如下:
select substr(regexp_substr(f1, ‘stockCode":"(\w)+‘), 13) as code1, (case when regexp_instr(f1, ‘stockCode":"(\w)+‘) > 0 then substr(regexp_substr(f1, ‘stockCode":"(\w)+‘, regexp_instr(f1, ‘stockCode":"(\w)+‘) + 1), 13) else null end) as code2, (case when regexp_instr(f1, ‘stockCode":"(\w)+‘) > 0 and regexp_instr(f1, ‘stockCode":"(\w)+‘, regexp_instr(f1, ‘stockCode":"(\w)+‘) + 1) > 0 then substr(regexp_substr(f1, ‘stockCode":"(\w)+‘, regexp_instr(f1, ‘stockCode":"(\w)+‘, regexp_instr(f1, ‘stockCode":"(\w)+‘) + 1) + 1), 13) else null end) as code3 from t1
标签:from nbsp 内容 ica when div weight ase class
原文地址:https://www.cnblogs.com/lavezhang/p/12191852.html