ORA-01401 Error Message
Learn the cause and how to resolve the ORA-01401 error message in Oracle.
Description
When you encounter an ORA-01401 error, the following error message will appear:
- ORA-01401: inserted value too large for column
Cause
You tried to insert a value into a column that exceeds the maximum width for the column.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Correct your SQL to truncate the value so that it fits within the field. You can always try the SUBSTR function to truncate the value.
Option #2
Modify your table definition to allow for a larger value in a field. This can be done with a ALTER TABLE command.
For example, if you had a table called suppliers defined as follows:
CREATE TABLE suppliers ( supplier_id number not null, supplier_name varchar2(10) );
And you tried to execute the following INSERT statement:
INSERT INTO suppliers ( supplier_id, supplier_name ) VALUES ( 10023, 'Hewlett Packard' );
You would receive the following error message:
You have defined the supplier_name column as a varchar2 that can only handle up to 10 characters. Yet, you have attempted to insert the value 'Hewlett Packard' (which is 15 characters in length) into this field.
No comments:
Post a Comment