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.
Example: Find if string A001G002F001H003Z701
contains F001
or B004
or J005
Which solution for this task is the most efficient? thx
You can use either 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.