文本中存在特殊字符,导致string转JSON时报错,可以使用regexp_replace对文本内容进行替换
select regexp_replace(STRING,obp.PRODUCT_NAME),' |\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\u0008|\u0009|\u000a|\u000b|\u000c|\u000d|\u000e|\u000f|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001a|\u001b|\u001c|\u001d|\u001e|\u001f|\u007F|\n|\"|\t|\r|\f|\b|\/|\\\\','')
注意,sql放到shell脚本中,\需要转义,如下:
select regexp_replace(STRING,obp.PRODUCT_NAME),' |\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\u0008|\u0009|\u000a|\u000b|\u000c|\u000d|\u000e|\u000f|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001a|\u001b|\u001c|\u001d|\u001e|\u001f|\u007F|\n|\"|\t|\r|\f|\b|\/|\\\\\\\\','')