[英]Teradata 15: parsing a string
The task is to scan a string varchar value, which can be null or 3 to N symbols length, and find out if it contains a specific combination in it. 任务是扫描字符串varchar值,该值可以为null或3到N个符号长度,并确定其中是否包含特定的组合。
Example: Find if string A001G002F001H003Z701
contains F001
or B004
or J005
示例:查找字符串A001G002F001H003Z701
包含F001
或B004
或J005
Which solution for this task is the most efficient? 哪种解决方案最有效? thx 谢谢
You can use either LIKE ANY
: 您可以使用LIKE ANY
:
WHERE x LIKE ANY ( '%F001%', '%B004%', '%J005%')
or a RegEx: 或正则表达式:
WHERE RegExp_Instr(x, 'F001|B004|J005') > 0
Run it against a huge table and compare CPU using Query Log 在一个巨大的表上运行它,并使用查询日志比较CPU
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.