在 Oracle DB 中使用非字母数字字符查找记录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31079489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Finding records in Oracle DB with non-alphanumeric characters
提问by Saqib Ali
I need to find all the records in an Oracle DB which have non-alphanumeric characters. I am trying to use the following, but it does not return anything. And I know there are records with non-alphanumeric characters:
我需要在 Oracle DB 中查找具有非字母数字字符的所有记录。我正在尝试使用以下内容,但它没有返回任何内容。而且我知道有非字母数字字符的记录:
select * from users where first_name LIKE '%[^a-z0-9A-Z]%'
select * from users where first_name LIKE '%[^a-z0-9A-Z]%'
回答by Oto Shavadze
select * from users where REGEXP_LIKE (first_name, '^[^0-9a-z]+$', 'i');
回答by xQbert
without the not you just get those with alpha numeric characters.
没有 not 你只会得到那些带有字母数字字符的字符。
SELECT * FROM users where not REGEXP_LIKE (first_Name, '^[0-9a-zA-Z]+$')