Common SQL Errors

MySQL Error 1690: ER_DATA_OUT_OF_RANGE - How to Fix Numeric Overflow Issues

Galaxy Team
August 7, 2025

<p>MySQL error 1690 occurs when a calculation or assignment produces a numeric value that exceeds the defined column data type range.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1690 (ER_DATA_OUT_OF_RANGE)?

<p>MySQL Error 1690: ER_DATA_OUT_OF_RANGE arises when a numeric operation exceeds the target column’s range. Cast values, widen column types, or enable sql_mode=STRICT_TRANS_TABLES to resolve the overflow and prevent future occurrences.</p>

Error Highlights

Typical Error Message

%s value is out of range in '%s'

Error Type

Data Range Error

Language

MySQL

Symbol

ER_DATA_OUT_OF_RANGE

Error Code

1690

SQL State

22003

Explanation

Table of Contents

What is MySQL Error 1690 (ER_DATA_OUT_OF_RANGE)?

MySQL throws error 1690 when an expression produces a numeric result that cannot fit within the target column or variable’s data type limits.

The server aborts the statement to prevent silent truncation or wrap-around, safeguarding data integrity.

When does ER_DATA_OUT_OF_RANGE occur?

The error appears during INSERT, UPDATE, and SELECT ... INTO operations that calculate values exceeding the maximum or minimum bounds of INT, DECIMAL, FLOAT, or DOUBLE columns.

It is also triggered inside stored routines or views that perform arithmetic yielding out-of-range results.

Why is fixing it critical?

Ignoring the overflow can cause data loss, inaccurate analytics, and application crashes. Addressing it ensures reliable calculations and trustworthy reports.

What Causes This Error?

Most frequently, ER_DATA_OUT_OF_RANGE comes from adding, multiplying, or concatenating numbers that surpass the signed or unsigned limits defined on numeric columns.

Mismatched data types, improper casting, and unexpected NULL-to-0 conversions under non-strict SQL modes can also push results beyond allowable ranges.

How to Fix MySQL Error 1690

First, identify the offending expression by checking the column referenced in the message. Then either widen the column type, cast the expression, or constrain the source data.

Switching to STRICT_TRANS_TABLES keeps MySQL from silently truncating future overflows and surfaces issues during development.

Common Scenarios and Solutions

When summing daily totals into an INT, switch the accumulator to BIGINT. For percentage calculations stored in TINYINT, move to DECIMAL(5,2) to handle 100.00 values.

If epoch milliseconds overflow INT, store them in BIGINT or divide by 1000 before persisting.

Best Practices to Avoid This Error

Design schemas with headroom: choose BIGINT for identifiers and large counters. Use DECIMAL for money to avoid floating-point rounding.

Enable STRICT_TRANS_TABLES or STRICT_ALL_TABLES in production. Leverage Galaxy’s AI copilot to scan queries and suggest safer data types during code reviews.

Related Errors and Solutions

Error 1264 Out of range value for column occurs on direct INSERT truncation. Fix by enlarging the column or validating input.

Error 1366 Incorrect integer value arises from invalid strings converted to numbers. Cast or sanitize user input before insertion.

Common Causes

Integer overflow

Adding or multiplying values produces a number larger than the INT or BIGINT limit.

Unsigned to signed mismatch

Storing a negative result in an UNSIGNED column triggers the error.

Decimal scale loss

Dividing numbers creates a high-precision decimal that exceeds DECIMAL scale.

Incorrect casting

Implicit conversions from strings or NULLs unintentionally widen results.

Related Errors

MySQL Error 1264: Out of range value for column

Occurs on direct INSERT or UPDATE when a value exceeds the column range without involving calculations.

MySQL Error 1366: Incorrect integer value

Triggered when non-numeric text is inserted into an integer column.

MySQL Error 1292: Truncated incorrect DOUBLE value

Raised when a string cannot be fully converted to a DOUBLE during comparison.

FAQs

Does ER_DATA_OUT_OF_RANGE depend on MySQL version?

The error exists in all maintained MySQL versions; only sql_mode defaults differ.

Will switching off strict mode hide the error?

Yes, but MySQL may silently truncate data, risking corruption. Keep strict mode enabled.

Can I catch the error in application code?

Yes. Check SQLSTATE 22003 or error code 1690 in your client library and handle gracefully.

How does Galaxy help?

Galaxy’s AI copilot flags potential overflows during query writing and suggests safer data types before execution.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo