RDS 事务型数据库sql

-- 替换json中数据


select SUBSTRING_INDEX(SUBSTRING_INDEX('[{"channelCode":"MOBIL","scale":1400000},{"channelCode":"WXMALL","scale":600000}]','},{',1),'scale":',-1);


select replace('[{"channelCode":"MOBIL","scale":1400000},{"channelCode":"WXMALL","scale":600000}]', SUBSTRING_INDEX(SUBSTRING_INDEX('[{"channelCode":"MOBIL","scale":1400000},{"channelCode":"WXMALL","scale":600000}]','},{',1),'scale":',-1), CAST(SUBSTRING_INDEX(SUBSTRING_INDEX('[{"channelCode":"MOBIL","scale":1400000},{"channelCode":"WXMALL","scale":600000}]','},{',1),'scale":',-1) as DECIMAL) + 1);

update virgo_trans_divide set divide_json=replace(divide_json, SUBSTRING_INDEX(SUBSTRING_INDEX(divide_json,'},{',1),'scale":',-1), CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(divide_json,'},{',1),'scale":',-1) as DECIMAL) + 1) where id = '18554';

上一篇:Exercise 20 functions and return


下一篇:QT中的qDebug()