【YashanDB知识库】同时设置默认值和非空约束时报错YAS-02070

来源:这里教程网 时间:2026-03-03 20:12:13 作者:

【问题分类】功能使用 【关键字】YAS-02070 【问题描述】 

SQL
create table test01(id int,name varchar(10));
insert into test01 values(1,'zhangsan');
commit;
SQL> alter table test01 add (c1 nclob default ' ' not null);
YAS-02070 table must be empty to add NOT NULL column

【问题原因分析】先判断了是否为空,后写入数据,调整代码实现顺序后即解决。 【解决/规避方法】升级到22.2.7.1及以后的版本 【影响范围】22.2.6.0及以前 【修复版本】22.2.7.1

相关推荐