MySQL “Out of range value” Error Explained & Fixed

Common SQL Errors

Galaxy Team
June 25, 2025
Data Integrity Error

The error means a value you try to store exceeds the numeric range or scale defined for the target column.

MySQL / MariaDB
Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

What is the "Out of range value" error?

Out of range value (Error 1264) occurs when an INSERT or UPDATE assigns a number larger than the column’s allowed range or scale. Cast the data, widen the column type, or clamp the input to resolve the issue.

Typical Error Message

ERROR 1264 (22003): Out of range value for column 'column_name' at row 1

Explanation

Table of Contents

What is the “Out of range value” error?

MySQL error 1264 triggers when an INSERT, UPDATE, or LOAD DATA statement supplies a numeric value that cannot be represented by the destination column’s data type or scale. The server blocks the write to protect data integrity.

The error surfaces most often with TINYINT, SMALLINT, INT, BIGINT, DECIMAL, and NUMERIC columns that have tight precision or are declared UNSIGNED.

When does this error occur?

The server evaluates each row before committing.

If any value falls outside the column’s min-max boundary or its DECIMAL precision/scale, MySQL raises error 1264 and—under strict SQL mode—rejects the entire statement.

In non-strict mode, MySQL may truncate the overflow value and issue a warning instead, potentially leading to silent data loss.

Why is it critical to fix?

Leaving the error unresolved blocks data ingestion pipelines, ETL jobs, and application writes.

Ignoring warnings in permissive modes risks corrupted analytics and faulty business logic due to silently altered numbers.

What Causes This Error?

Primary triggers include numeric overflow, wrong UNSIGNED / SIGNED selection, DECIMAL scale mismatches, and strict SQL mode enforcement. Each cause is fixable through schema updates or data cleansing workflows.

How to Fix “Out of range value”

Identify the offending column and row, widen the data type or convert incoming data.

Typical remedies involve altering column definitions, using CAST(), or bounding values with LEAST()/GREATEST().

Common Scenarios and Solutions

Overflowing auto-increment counters, importing CSVs with rogue values, and migrating from PostgreSQL BIGINT to MySQL INT are frequent sources.

Step-by-step SQL fixes appear below.

Best Practices to Avoid This Error

Design schemas with headroom, validate inputs in application code, enable monitoring for warnings, and adopt tools like Galaxy’s AI copilot to flag type mismatches during query authoring.

Related Errors and Solutions

Numeric value out of range (SQLSTATE 22003) in PostgreSQL, Data truncated for column in MySQL, and Division by zero errors share similar root causes and preventive tactics.

.

Common Causes

Related Errors

FAQs

Does this error always stop the query?

Yes in strict mode. In permissive modes MySQL may insert a truncated value and issue only a warning.

How do I find the failing column?

The error message shows the exact column name and row offset; use LIMIT and ORDER BY to reproduce.

Can Galaxy help prevent this?

Galaxy’s AI copilot highlights type mismatches while you write SQL and suggests ALTER statements before execution.

Is changing sql_mode safe?

Disabling strict mode should be temporary; long-term fixes involve schema or data corrections.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
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