I have a column whose values are supposed to be 11 numbers, however, some of them have less than 11 numbers. How can I write a query that will return all the values in this column that have less than 11 numbers. I am working in Teradata
Asked
Active
Viewed 178 times
0
-
What is the data type of the column? If it's a character string, are there characters other than digits present? – Fred Oct 26 '21 at 22:34
-
Hi Fred, data type is string and there are no other characters other than digits. – Bond Oct 26 '21 at 22:37
-
`where char_length(col) < 11` to simply check for 11 characters. Or `where regexp_similar(col, '\d{11}' = 0` to check for exacty 11 digits. If it's a CHAR or there might be leading/trailing spaces switch add `TRIM`. – dnoeth Oct 27 '21 at 07:48