我可以这样做
where Col like '%Mystring%String2%'
在Teradata SQL中,我可以使用?
进行单个字符匹配。我该如何搜索
使用Terdata SQL Regex的内容模式是这样的
String<one of more instance of spaces or non alpha chars>string2
例如
IS NOT NULL
或
IS NOT NULL
2个或更多字符串之间有1个或多个空格实例或其他非字母字符
例如。考虑这个字符串是sqltext
数据库中PDCR
的一部分
sel t1.c1, t2.c2, t3.c3 from
t1 , t2 ,t3
where t2.Cx is NULL and t3.cy IS NOT NULL and
t3.Ca is NULL AND
t3.cb is NULL AND t3.c7 is NOT NULL
and t3.c10 not like any ('%searchstring%','%string%','%||||%')
请注意NOT
和NULL
以及IS
和NULL
所以我想形成where
条款,检查各种非alpha条件,例如(这是更多伪代码,例如。不好意思)
where Sqltext like '%NOT<1 or more instances of Spaces only>NULL%'
or SQLtext like '%,\%<one or more instances of | character%' escape '\'
这就是我要找的东西。 REGEXP_SIMILAR
似乎很有希望。试着用where
子句
答案 0 :(得分:2)
使用正则表达式\s
查找空格(空格,制表符,CRLF):
WHERE REGEXP_SIMILAR(col,'.*?IS[\s|\|]+NOT.*?','i') = 1
.*? -- any characters
IS -- 1st string
[\s|\|]+ -- one or more whitespaces and/or |
NOT -- 2nd string
.*?' -- any characters
或REGEXP_INSTR,因为你不需要&#34;任何字符&#34;在开始和结束时:
WHERE REGEXP_INSTR(x,'IS[\s|\|]+NOT',1,1,0,'i') > 0