当前位置: 代码迷 >> Oracle管理 >> sqlplus平添字段出错
  详细解决方案

sqlplus平添字段出错

热度:93   发布时间:2016-04-24 04:55:01.0
sqlplus添加字段出错
为什么我写:
alter table employee
add salary number(7,3) not null default 0
会报错说:
第 2 行出现错误:
ORA-30649: 缺少 DIRECTORY 关键字
怎么解决?
------最佳解决方案--------------------
引用:
为什么我写:
alter table employee
add salary number(7,3) not null default 0
会报错说:
第 2 行出现错误:
ORA-30649: 缺少 DIRECTORY 关键字
怎么解决?


把NOT null 放到 default 后面

hr@ORCL> create table t (n number);

Table created.

hr@ORCL> alter table t add i varchar2(10) default '0' not null;

Table altered.


------其他解决方案--------------------
  alter table testa
add salary number(7,3)  default 0
------其他解决方案--------------------
增加字段时候无法约束 not null
可以再写一个alter语句去增加这个constraint
  相关解决方案