To identify an invalid number in Oracle, you need to answer two separate questions: is the value actually unparseable as a number, and does its stored data type prevent it from being checked at all? In a VARCHAR2 column, a string like '12.3.4' or '1,234' can be caught by a validation expression or by a conversion attempt. In a NUMBER column, no invalid value can physically exist, so the "invalid" problem usually moves upstream to whichever process converged the text. The practical work is building a check that catches every bad row without aborting the query, then fixing the source that let it through.

Why "invalid number" means different things in Oracle

Oracle's error ORA-01722 ("invalid number") appears when a character value can't be converted to a numeric type in the current context. That context matters enormously. TO_NUMBER('1234.5') succeeds under a session whose NLS_NUMERIC_CHARACTERS is ., but fails on the same string if the session expects , as the decimal marker and . as the group separator. The same text is valid in one session and invalid in another, which is why validation results can differ between SQL Developer, a scheduled job, and an application connection pool.

There's a second, quieter category: values that convert but aren't the numbers you meant. '1,234' might convert to 1.234 in a European session, not 1234. ' 42 ' converts fine because Oracle trims surrounding spaces during numeric conversion, so a "dirty" value passes a naive check. And '1e5' is a legitimate numeric literal, so exponent notation may slip through formats you thought were strict.

Finally, a NUMBER column can't hold an invalid number at all; it holds a value or NULL. If someone tells you a NUMBER column contains invalid data, they almost certainly mean the source text (a staging VARCHAR2 column, a CSV, an API payload) was invalid and got dropped, defaulted, or converted with rounding before insertion. Identifying the problem then becomes tracing back to the text.

Prerequisites before you write any validation query

Confirm three things first, because each one changes which check is correct.

The column's data type. Run a quick describe or query the data dictionary:

If DATA_TYPE is NUMBER, stop treating it as a text problem and find the loading path. If it's VARCHAR2, CLOB, or a similar character type, validation applies.

If you're validating data that a different application wrote, validate under the same settings that application uses, or make the check independent of session settings (covered below).

The intended format. Decide whether the column should accept integers only, decimals, negative signs, exponent notation, or none of those. A check is only meaningful against a spec. Write the spec down as a regular expression or range before touching the data.

Step 1: Find the rows that currently fail conversion

The plainest approach is to attempt the conversion and let failures surface. On Oracle Database 12c Release 2 and later, VALIDATE_CONVERSION does exactly this without raising an error:

A return of 0 means the conversion would fail; 1 means it would succeed. This is the cleanest first pass because it uses Oracle's own conversion rules, including the current session's numeric characters and support for leading signs, spaces, and exponent notation. Its behavior follows the session NLS settings, so run it under the session whose format you're enforcing.

On older releases, or when you want the actual error, a small PL/SQL function that traps the exception is the reliable route:

Then query WHERE is_number(amount_text) = 0. Two cautions. First, this per-row PL/SQL call is slow on large tables because of the context switch between SQL and PL/SQL, so scope it with a filter or run it on a sample first. Second, catching OTHERS is broad; narrowing to WHEN VALUE_ERROR is tidier, though some conversion failures arrive as other exceptions depending on the path. The function also inherits session NLS behavior, since TO_NUMBER without a format mask uses it.

If you only need a count rather than row detail, pair either approach with a COUNT and let the optimizer handle it:

Step 2: Use a regular expression when the format matters

VALIDATE_CONVERSION answers "would Oracle convert this?" It doesn't answer "is this the format our business rules require?" For that, REGEXP_LIKE gives you explicit control and is independent of NLS settings, which makes it the better choice for consistent results across environments.

An integer-only check:

A decimal check allowing an optional sign, optional fractional part, and no thousands separators:

Be aware of what each pattern rejects on purpose. The decimal pattern above rejects '1,234', '1 234', '1.2.3', '$5', '12%', '' (empty string), and a string containing only spaces. It accepts '007', which is numerically fine but may violate a leading-zero rule; if so, tighten the pattern. Because REGEXP_LIKE returns NULL for NULL input, the NOT REGEXP_LIKE(...) predicate excludes NULLs rather than flagging them, so handle NULLs as a separate check if the column is supposed to be populated.

A common trap: [0-9] matches only ASCII digits, while \d in Oracle's POSIX-style regular expressions can also match non-ASCII digits in some character sets. Use [0-9] when you mean ASCII digits.

This is where most validation projects go wrong. If the source system writes '1,234.56' (US style) and your database session uses . as the decimal marker, TO_NUMBER fails on the comma unless you supply a format model. If the source writes '1.234,56' (many European locales), the reverse happens.

Two defensible policies exist, and you should pick one deliberately:

Treat separators as formatting, not data. Strip them before conversion with REPLACE(amount_text, ',', '') and then validate, documenting that the comma is a group separator. This is simple but silently misreads genuinely ambiguous input like '1,234', which could be 1234 or 1.234 depending on locale.

Reject anything that doesn't match the agreed canonical format. Use the regex from Step 2, which allows no separators at all, and require upstream systems to send plain decimal text. This produces cleaner data and clearer errors.

If you must accept a locale-specific format, pass an explicit format model to TO_NUMBER so the result doesn't depend on session settings:

The third argument overrides session NLS for that call, which is the only way to make conversion reproducible across environments.

Step 4: Separate NULLs, blanks, and non-numeric text

A complete audit distinguishes at least four conditions, because they need different fixes:

NULL means no value was supplied. Whether that's invalid depends on your business rule, not on numeric parsing.

An empty string. In Oracle, '' is stored as NULL in VARCHAR2, so a blank-looking field may be NULL, not empty. LENGTH(TRIM(col)) = 0 catches rows that are NULL or contain only spaces.

Whitespace-only or padded values. TRIM first, then validate the trimmed text, and decide whether to store the trimmed or raw form.

Actual non-numeric characters. These are the true ORA-01722 candidates once NULLs are excluded.

A single query that classifies all four:

This gives you a defensible report rather than a list of failures.

Step 5: Catch values that convert but are wrong

Some rows pass every check and still corrupt your numbers. The most common case is silent truncation on insert. If you insert '12.7' into a NUMBER(3) column, Oracle rounds to 13 without an error; that's a valid conversion producing a value you may not want. Similarly, inserting '1234' into NUMBER(3) raises ORA-01438 (value larger than specified precision), which is a different error from ORA-01722 but often appears in the same batch.

Check precision and scale explicitly before inserting:

Adjust the constants to your column's precision and scale. This catches overflow and fractional values that would be rounded away.

Another trap: comparing a character column to a number in a WHERE clause. WHERE amount_text = 100 forces implicit conversion of the column, and if any row's text is non-numeric, the whole query fails with ORA-01722 even though you only wanted the matching rows. The fix is to validate first or compare as text: WHERE amount_text = '100'. This is one of the most frequent causes of "invalid number" errors that appear to come from nowhere.

Step 6: Fix the source, not just the query

Finding invalid rows is diagnosis. The lasting fix is upstream enforcement.

For new tables, store numbers in NUMBER columns and let the database reject bad input at insert time. For staging tables that must accept text, add a check constraint with a validation expression, or at minimum a scheduled job that flags failures. In Oracle Database 12c Release 2 and later, a check constraint can use VALIDATE_CONVERSION, though it follows session NLS behavior at evaluation time, which can create surprises if sessions vary. A regex-based check constraint is more predictable.

In ETL, use explicit format models on every TO_NUMBER, prefer VALIDATE_CONVERSION over blind conversion, and route failures to a reject table with the raw text preserved. Never let a default like NVL(col, 0) hide a format error; zero is a legitimate number and will mask the problem.

For data already loaded, the repair is a controlled update: identify with the query, correct in source, reload, and re-run the audit. Avoid updating directly from TO_NUMBER on the raw text unless the query already proved every row converts, or you'll get ORA-01722 partway through a multi-million-row update.

What to expect and how to confirm success

After a first pass, most tables reveal a few recurring patterns: commas, currency symbols, percent signs, stray spaces, and mixed decimal conventions. Fixing the source format usually eliminates the bulk of failures.

To confirm the audit is complete, run the classification query from Step 4 and check that the count of non-OK rows matches a manual sample. Re-run VALIDATE_CONVERSION under the same session settings the loader uses. If the counts differ between sessions, your validation is NLS-dependent and needs to be pinned with explicit format models or replaced by regex. Also run a NULL check on any column that's supposed to be mandatory; a clean numeric audit with 40% NULLs is not a clean result.

A specific stopping point: if invalid values appear in a NUMBER column, or if a validated load still produces ORA-01438 or rounding differences at a rate you can't explain from the source data, stop manual repair and involve whoever owns the schema and loading process. Those symptoms indicate a type, precision, or conversion-rule mismatch that query-level fixes won't resolve and that can quietly change stored values if patched ad hoc.