页面树结构
转至元数据结尾
转至元数据起始

(本文档仅供参考)

问题说明

Smartbi里面写SQL,包含正则表达式的时候,读取方括号报错:表达式解析错误: expecting STRING_LITERAL, found '['

请问如何在smartbi里写正则表达式?

有两处正则表达式

REGEXP_LIKE(SUBSTR(REPLACE(SUBJECTCODE, '_', ''), 9), '^[a-zA-Z]+')

REGEXP_LIKE(SUBJECTCODE, '11057201_[0-9]{6,}')

解决方案

由于smartbi解析器不支持使用特殊字符^,可将此字符转义后再使用,将^替换为chr(94),其中94为^字符对应的ascii值,可通过数据库工具执行select ASCII('^') from dual 获取得到
REGEXP_LIKE(SUBSTR(REPLACE(SUBJECTCODE, '_', ''), 9), chr(94)||'[a-zA-Z]+')
    
REGEXP_LIKE(SUBJECTCODE, '11057201_[0-9]{6,}'),该表达式未使用特殊字符,可正常支持,无需调整。

Viewtracker License Missing

There is a problem with the license of the Viewtracker addon. Please check if you have a valid license.

授权码细节

  • 无标签