I have a large table with phone numbers. The phone numbers are all strings and supposed to be '+9628789878' or similar. (a "+" sign followed by between 9 and 13 digits.)
A user bug uncovered one row with the string '+987+9873678298'. Clearly it shouldn't be there and I'd like to find out how many other cases there are of this or other such errors.
I tried this query but it's not doing the job. My thinking is anything that's not like this string. (Oh, the table is not indexed by phone_number.)
SELECT user_key,
first_name,
last_name,
phone_number
FROM users u
WHERE regexp_like(phone_number, '[^\+[0-9]*]')
AND phone_number IS NOT NULL
phone_number IS NOT NULLis unnecessary because NULL values won't make it throughregexp_likeanyway.