ORA-01758: table must be empty to add mandatory (NOT NULL) column

来源:互联网 发布:win10安装ubuntu 多图 编辑:程序博客网 时间:2024/05/18 10:36

 

http://ora-01758.ora-code.com/

ORA-01758:

table must be empty to add mandatory (NOT NULL) column

Cause:

It is not possible to define a new column as NOT NULL if rows already exist in the table being modified.

Action:

Retry the statement without the NOT NULL specification.

 

 

alter table GCD.DAILY_ACCRUAL_VIRTUS_STAG add
(
    ASOFDATE       DATE NOT NULL
)
/
update GCD.DAILY_ACCRUAL_VIRTUS_STAG set asofdate=trunc(sysdate, 'dd')
/
alter table GCD.DAILY_ACCRUAL_VIRTUS_STAG modify
(
    ASOFDATE        NOT NULL
)
/