SQL 正则表达式抛出状态=42000,代码=40000

Posted

技术标签:

【中文标题】SQL 正则表达式抛出状态=42000,代码=40000【英文标题】:SQL Regex throwing state=42000,code=40000 【发布时间】:2020-02-03 13:41:56 【问题描述】:
case regexp_extract(network_information,'^([\\w|-]+)[.|;].*',1) then .........

对于这部分代码,我得到 ParseException line 22:2 cannot identify input near '*' ',' 'case' in expression specification (state=42000,code=40000) 谁能帮帮我。

【问题讨论】:

【参考方案1】:

regexp 看起来不错。案例是错误的。应该是这样的:

case when regexp_extract(network_information,'^([\\w|-]+)[.|;].*',1) = 'something'
         then ...
 end

或者像这样:

case regexp_extract(network_information,'^([\\w|-]+)[.|;].*',1)
     when 'something'      then ...
     when 'something-else' then ...
 end

【讨论】:

以上是关于SQL 正则表达式抛出状态=42000,代码=40000的主要内容,如果未能解决你的问题,请参考以下文章