oracle 字段like多个条件(or关系)

  |   0 评论   |   0 浏览

写oracle sql时有时候会有 and (字段 like ‘匹配串1’or 字段 like ‘匹配串2’or ...)这样的情况出现,下面提供一个简洁点的解决方案--

and REGEXP_LIKE(字段名, '(匹配串1|匹配串2|...)') //全模糊匹配

and REGEXP_LIKE(字段名, '^(匹配串1|匹配串2|...)') ";//右模糊匹配

and REGEXP_LIKE(字段名, '(匹配串1|匹配串2|...)$') ";//左模糊匹配