Skip to content
Oracle Database

Oracle Error ORA-00932

expression is of data type X, which is incompatible with expected data type Y (inconsistent datatypes)

Applies to: Oracle Database 19c, 21c, 23ai and 26ai (wording differs: see below)
Last technically reviewed 24 October 2026 on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally
The full message
ORA-00932: expression 20261024 is of data type NUMBER, which is incompatible with expected data type DATE
Other forms of this message
Oracle Database 19c and 21c
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
A CASE expression whose branches return different types (19c and 21c)
ORA-00932: inconsistent datatypes: expected CHAR got NUMBER
SQL*Plus and SQLcl show the failing line first
ERROR at line 3:
ORA-00932: expression 20261024 is of data type NUMBER, which is incompatible with expected data type DATE
Error code
ORA-00932
Product
Oracle Database
Versions
Oracle Database 19c, 21c, 23ai and 26ai (wording differs: see below)
Last reviewed
24 October 2026

What it means

ORA-00932 means an operation received a value of one data type where it needs another, and Oracle has no implicit conversion between the two, for example a NUMBER compared with a DATE or CASE branches that return text and numbers.

Oracle converts some data types implicitly: a string that looks like a number can be compared with a NUMBER, for instance. The SQL Language Reference lists which implicit conversions exist; where there is none, such as NUMBER to DATE, the statement fails with ORA-00932. The current message names the expression, its data type and the type that was expected. 19c and 21c print the short form inconsistent datatypes: expected X got Y.

In the 19c form, read the two type names carefully: "expected" is the type the operation needed and "got" is the type it received, so the expression with the "got" type is the one to convert or rewrite. The 19c reference also lists two rarer causes: operations on LONG columns (functions and concatenation cannot be used with LONG), and querying database objects that are not intended for normal use.

Common causes

  • A DATE column is compared with a number such as 20261024; there is no implicit conversion from NUMBER to DATE.
  • A CASE or DECODE returns a string in one branch and a number or date in another; the SQL Language Reference requires all CASE return expressions to have the same data type (or all be numeric).
  • The two branches of a UNION or UNION ALL put different data types in the same column position.
  • A LONG column is passed to a function or concatenated with ||, which Oracle does not allow for LONG data.

Diagnose it

Read-only These queries only read the data dictionary (USER_, ALL_ and DBA_ views) and dynamic performance views (V$). They do not change data, privileges or settings, so they are safe to run first. DBA_ and V$ views need the matching privileges.

Check the declared types of the columns involved

Read the expected and actual types from the message, then confirm the column types in the dictionary.

SELECT column_name, data_type, data_length, data_precision, data_scale
FROM all_tab_columns
WHERE owner = 'SHOP'
  AND table_name = 'ORDERS'
ORDER BY column_id;
What to look for

The data type of each column. A column you thought was a number may be a DATE or VARCHAR2, or a legacy column may be LONG.

Check the type of each expression with DUMP

DUMP shows the internal type code of a value (Typ=1 is VARCHAR2 or NVARCHAR2, Typ=2 NUMBER, Typ=12 DATE, Typ=96 CHAR). Use it on each branch of a CASE, DECODE or UNION to find the one that differs.

SELECT DUMP(order_date)  AS order_date_type,
       DUMP(discount)    AS discount_type,
       DUMP('none')      AS literal_type
FROM shop.orders
FETCH FIRST 1 ROW ONLY;
What to look for

Strings such as Typ=12 Len=7: .... Two branches with different Typ values (and no implicit conversion between them) explain the error.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Compare dates with dates

Read-only

Write the value as a DATE: an ANSI date literal, or TO_DATE with an explicit format model. If the number is a stored yyyymmdd key, convert it with TO_DATE(TO_CHAR(n), 'YYYYMMDD').

SELECT order_id, amount
FROM shop.orders
WHERE order_date >= DATE '2026-10-24'
  AND order_date <  DATE '2026-10-25';

Give every CASE branch the same data type

Read-only

Convert the odd branch explicitly. Here the number becomes text so that both branches return VARCHAR2; alternatively return NULL instead of 'none' and keep the column numeric.

SELECT order_id,
       CASE WHEN discount IS NULL THEN 'none'
            ELSE TO_CHAR(discount)
       END AS discount_label
FROM shop.orders;

Line up the column types in UNION branches

Read-only

Each column position must have compatible types in every branch. Convert explicitly, or use a typed NULL such as CAST(NULL AS DATE) for a column that one branch does not have.

SELECT order_id, order_date FROM shop.orders
UNION ALL
SELECT return_id, CAST(NULL AS DATE) FROM shop.returns;

Move LONG columns to CLOB

Changes schema

LONG is kept only for backward compatibility and cannot be used in functions or concatenation. Converting the column to CLOB lets ordinary character functions work on it. Test on a copy first: the conversion rewrites the column.

Caution: Rewrites every row of the table and can take a long time on large tables; take a backup and check dependent code (PL/SQL that reads the column as LONG) before running it.

ALTER TABLE shop.legacy_notes MODIFY (note_text CLOB);

Examples

A DATE column compared with a number

Not reproduced here: no Oracle Database is installed for this site. The result follows the message format in Oracle's current error reference; how the failing expression is printed is illustrative. Oracle Database 19c and 21c print "ORA-00932: inconsistent datatypes: expected DATE got NUMBER".

SELECT order_id, amount
FROM orders
WHERE order_date = 20261024;
Expected result (documented format, not run)
ORA-00932: expression 20261024 is of data type NUMBER, which is incompatible with expected data type DATE

CASE branches that return text and a number

Not reproduced here: no Oracle Database is installed for this site. This shows the 19c and 21c message format from Oracle's error reference; current releases use the longer "expression ... is of data type NUMBER, which is incompatible with expected data type ..." form, with the expression and type names filled in by the database. The rule that CASE return expressions must share a data type is in the SQL Language Reference.

SELECT order_id,
       CASE WHEN discount IS NULL THEN 'none' ELSE discount END AS discount_label
FROM orders;
Expected result (documented format, not run)
ORA-00932: inconsistent datatypes: expected CHAR got NUMBER

How to prevent it

Use explicit conversion functions (TO_DATE, TO_NUMBER, TO_CHAR, CAST) instead of relying on implicit conversion; Oracle's SQL Language Reference recommends this and notes that implicit conversion algorithms can change between releases. Write date constants as DATE 'YYYY-MM-DD' literals.

When a CASE, DECODE or UNION returns a column, decide its data type first and make every branch return it. Keep dates in DATE or TIMESTAMP columns rather than numbers or strings. See SQL data types explained.

Common questions

How do I fix ORA-00932 inconsistent datatypes?

Read the expected and actual types from the message, find the expression of the wrong type (the "got" type in 19c, the named expression in current releases) and convert it explicitly with TO_DATE, TO_CHAR, TO_NUMBER or CAST so both sides have compatible types.

What does "expected - got CLOB" or another odd type name mean?

The "got" type is what the operation received. CLOB, LONG and BLOB values cannot be used everywhere a VARCHAR2 can; check the restrictions for that type in the SQL Language Reference and convert or restructure the query.

Why does the message look different in Oracle 19c?

The current error reference rewrote the message to name the failing expression and both data types in full sentences. 19c and 21c print "inconsistent datatypes: expected X got Y". The cause and the fixes are the same.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 October 2026; examples and diagnostics run on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally. Messages and explanations follow Oracle's Database Error Messages reference; no Oracle Database was available, so the examples were not run locally.

Still stuck on an Oracle error?

Browse the full Oracle error library, or get hands-on help from an experienced SQL professional.