Oracle查询以查找不包含字符的字符串 [英] Oracle query to find string not containing characters

查看:1138
本文介绍了Oracle查询以查找不包含字符的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是Oracle查询,它将返回所有记录,其中字段mytable.myname包含任何个字符其他

What is an Oracle query that will return all records where the field mytable.myname contains any characters other than

  1. A-Z
  2. a-z
  3. 0-9
  4. -/\()
  1. A-Z
  2. a-z
  3. 0-9
  4. -/\()

推荐答案

您可以使用以下内容:

SELECT * FROM mytable WHERE REGEXP_LIKE (myname, '^[^a-zA-Z0-9\/\\()-]+$');

您还可以使用i修饰符执行相同的操作:

You can also do the same with an i modifier:

SELECT * FROM mytable WHERE REGEXP_LIKE (myname, '^[^a-z0-9\/\\()-]+$', 'i');

说明:

  • ^字符串的开头
  • [^___ ]否定字符集(它将匹配其中指定的字符以外的任何字符)
  • +多次匹配上一个组
  • $字符串的结尾
  • ^ start of the string
  • [^___ ] negative character set (which will match any character other than the characters specified inside it)
  • + match the previous group more than once
  • $ end of the string

这篇关于Oracle查询以查找不包含字符的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆