Reputation: 56669
What is an Oracle query that will return all records where the field mytable.myname
contains any characters other than
A-Z
a-z
0-9
-/\()
Upvotes: 4
Views: 19106
Reputation: 13640
You can use the following:
SELECT * FROM mytable WHERE REGEXP_LIKE (myname, '^[^a-zA-Z0-9\/\\()-]+$');
You can also do the same with an i
modifier:
SELECT * FROM mytable WHERE REGEXP_LIKE (myname, '^[^a-z0-9\/\\()-]+$', 'i');
Explanation:
^
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 stringUpvotes: 9