CASE expression returns mixed types: conversion failed / types cannot be matched
The branches of a CASE expression produce incompatible data types (text and number, date and string).
CASE types cannot be matchedCASE types integer and text cannot be matchedConversion failed when converting the varchar value to data type int CASECASE expression mixed data typesORA-00932 inconsistent datatypes CASE Meaning
All THEN/ELSE results must resolve to a common type. Cast branches explicitly (CAST(x AS varchar)), and watch for NULL/empty strings mixed with numbers.
Common causes
- Number and text mixed in the branches
- Date and string branches
- Implicit conversion order (data type precedence)
- Empty string in a numeric branch
- NULL typed unexpectedly
⚡ Quick fix
- Cast every branch to the same type
- Use
NULLor0consistently - Check data type precedence rules for your DB
Detailed fix by platform
SQL
SELECT CASE WHEN qty > 0 THEN CAST(qty AS varchar(10)) ELSE 'none' END FROM stock;
How to diagnose
- Branch types — Same?
- Cast — Explicit?
- Empty string — In numeric branch?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026