oracle ALTER TABLE 语法 - 缺少 DIRECTORY 关键字

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12873667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:10:46  来源:igfitidea点击:

ALTER TABLE syntax - missing DIRECTORY keyword

sqloracle

提问by Sarahfromnowhere

I am trying to alter a table in Oracle database by adding two new columns to it with SQL query as below:

我试图通过使用 SQL 查询向其中添加两个新列来更改 Oracle 数据库中的表,如下所示:

ALTER TABLE Members 
      ADD annual_dues NUMBER(5,2) not null DEFAULT '52.50', 
      ADD payment_date DATE;

On executing it, I am getting an error as below:

在执行它时,我收到如下错误:

SQL Error: ORA-30649: missing DIRECTORY keyword

SQL 错误:ORA-30649:缺少 DIRECTORY 关键字

I have played around it but it didn't help. What is wrong in the SQL query?

我玩过它,但它没有帮助。SQL 查询有什么问题?

回答by ypercube??

I think you need to put NOT NULLafter the DEFAULT 52.50:

我认为你需要把NOT NULLDEFAULT 52.50

ALTER TABLE Members 
   ADD ( annual_dues NUMBER(5,2) DEFAULT 52.50 NOT NULL
       , payment_date DATE );