oracle 具有默认值的 SQL ALTER TABLE
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13435230/
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:15:51 来源:igfitidea点击:
SQL ALTER TABLE with default
提问by user1756421
I'm trying to alter a table in Oracle. I have to give a column in a table a default value of 1
. This is simple enough when making the table but I have to do it using the ALTER TABLE
feature, This is what I have:
我正在尝试更改 Oracle 中的表。我必须为表中的一列提供默认值1
. 制作表格时这很简单,但我必须使用该ALTER TABLE
功能来完成,这就是我所拥有的:
ALTER TABLE Stock_Qty
ADD CONSTRAINT Qty_DEFAULT_Value DEFAULT (Qty 1);
It doesn't seem to work.
它似乎不起作用。
回答by ron tornambe
Here's the correct syntax:
这是正确的语法:
ALTER TABLE Stock_Qty
MODIFY Qty DEFAULT 1