Error
Error Code: 1525

MariaDB Error 1525: Incorrect Value Provided

📦 MariaDB
📋

Description

This error indicates that a value supplied in a SQL statement (e.g., INSERT, UPDATE, SET) or function call is not valid for the data type, domain, or allowed set of values expected by the database. It commonly occurs when trying to assign an incompatible value to a column or parameter.
💬

Error Message

Incorrect %s value: '%s'
🔍

Known Causes

4 known causes
⚠️
Data Type Mismatch
Attempting to assign a value whose data type is incompatible with the target column's defined type (e.g., string into an integer column).
⚠️
Invalid ENUM or SET Value
Providing a value that is not among the predefined allowed values for an ENUM or SET column type.
⚠️
Out-of-Range Numeric Value
Trying to store a number that exceeds the maximum or falls below the minimum allowed for a specific numeric data type (e.g., TINYINT, YEAR).
⚠️
Incorrect Date/Time Format
Supplying a date or time string that does not conform to the expected format for DATE, DATETIME, or TIME columns.
🛠️

Solutions

3 solutions available

1. Verify Data Type and Format for Column Insertion easy

Ensure the data you are trying to insert matches the expected data type and format of the target column.

1
Identify the table and column that is causing the error. The error message usually indicates the problematic column name and the incorrect value.
2
Examine the table schema to understand the data type of the column. You can use `DESCRIBE table_name;` or `SHOW CREATE TABLE table_name;`.
DESCRIBE your_table_name;
3
Compare the data type of the column with the format of the value you are attempting to insert. For example, if the column is an `INT`, ensure you are inserting a number. If it's a `DATE` or `DATETIME`, ensure it's in a recognized format like 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'.
4
Correct the data type or format of the value in your `INSERT` or `UPDATE` statement.
-- Example for a DATE column
INSERT INTO your_table_name (date_column) VALUES ('2023-10-27');

-- Example for an INT column
INSERT INTO your_table_name (int_column) VALUES (123);

-- Incorrect example that would cause the error if date_column is DATE type
-- INSERT INTO your_table_name (date_column) VALUES ('October 27, 2023');

2. Check Stored Procedure or Function Arguments medium

If the error occurs within a stored procedure or function, validate the data types and values passed as arguments.

1
Pinpoint the stored procedure or function that is executing when the error occurs. This might be evident from the application logs or by tracing the execution flow.
2
Review the definition of the stored procedure or function to understand the expected data types for its parameters. Use `SHOW CREATE PROCEDURE procedure_name;` or `SHOW CREATE FUNCTION function_name;`.
SHOW CREATE PROCEDURE your_procedure_name;
3
Examine the `CALL` statement or the invocation of the function from your application or other SQL code. Ensure that the values being passed as arguments match the declared data types of the parameters.
-- Example of calling a procedure
CALL your_procedure_name(argument1, argument2);

-- If argument1 is expected to be an INT, passing a string might cause Error 1525.
4
Modify the `CALL` statement or the application code to pass arguments with the correct data types and formats.

3. Validate `ENUM` or `SET` Column Values easy

Ensure that values inserted into `ENUM` or `SET` columns are valid members of the defined set.

1
Identify the `ENUM` or `SET` column causing the error. The error message should provide clues.
2
Retrieve the definition of the `ENUM` or `SET` column to see the allowed values. Use `SHOW CREATE TABLE table_name;`.
SHOW CREATE TABLE your_table_name;
3
Compare the value you are trying to insert with the list of allowed values for the `ENUM` or `SET` column. For `ENUM`, the value must exactly match one of the defined members. For `SET`, the value must be a comma-separated string of valid members.
4
Correct the value in your `INSERT` or `UPDATE` statement to be one of the valid options for the `ENUM` or `SET` column.
-- Example if your_enum_column is ENUM('active', 'inactive')
INSERT INTO your_table_name (your_enum_column) VALUES ('active');

-- Example if your_set_column is SET('read', 'write', 'execute')
INSERT INTO your_table_name (your_set_column) VALUES ('read,write');

-- Incorrect example that would cause the error
-- INSERT INTO your_table_name (your_enum_column) VALUES ('enabled');
🔗

Related Errors

5 related errors