ORA-01441 Error解决办法

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Error Message

ORA-01441: column to be modified must be empty to decrease column length

Cause of Error

You tried to execute an SQL ALTER TABLE MODIFY statement on a character column to decrease its size, but the column contained data. You can only modify the character column whose values are all NULL.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Execute an UPDATE statement to change all values in that column to NULL.

Option #2

Execute a DELETE statement to remove all rows from the table.

For example, if you had a table called suppliers defined as follows:

CREATE TABLE suppliers

( supplier_id number(5),

supplier_name char(100)

);

Then executed an INSERT statement as follows:

INSERT into suppliers

(supplier_id, supplier_name)

VALUES (12345, 'IBM');

And you tried to execute the following ALTER TABLE statement:

ALTER TABLE suppliers

MODIFY supplier_name char(75);

You would receive the following error message:

You could correct the error with either of the following solutions:

Solution #1

You can update the supplier_name column to all NULLs. This only works if the

supplier_name field will accept NULL values.

UPDATE suppliers

SET supplier_name = NULL;

Solution #2

You can remove all entries from the suppliers table.

DELETE FROM suppliers;

If you do decide to delete all entries from your suppliers table, you might want to make sure that you have a backup of the data.

相关文档
最新文档