Numeric validation with Oracle regexp_like

PROBLEM:
Identify records where there is non-numeric values for a particular column.

SOLUTION:


select SOME_COL
from SOME_TBL
where regexp_like (SOME_COL,'^[^[:digit:]]')
;

Obviously this implies that maybe the field should be a NUMBER datatype to start with, but sometimes what we want, what we should have, and what we actually have are not the same thing.

This entry was posted in oracle/sqlserver/database. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>