oracle 要修改的列不是标识列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34972855/
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
Column to be modified is not an identity column
提问by Asif Mushtaq
I have created a table with column S_ROLL NUMBER(3) NOT NULL
Now I want to make this colum to as identity column.
I used this command
我已经创建了一个带有列的表S_ROLL NUMBER(3) NOT NULL
现在我想将此列作为标识列。我用过这个命令
alter table students
modify
(
S_ROLL NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY
);
Then I'm getting this error.
然后我收到这个错误。
S_ROLL NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY
*
ERROR at line 4:
ORA-30673: column to be modified is not an identity column
回答by Incognito
You're getting this error simply because modifying an existing column as IDENTITY column is not supported right now.
您收到此错误只是因为现在不支持将现有列修改为 IDENTITY 列。
The solution is to add a new column and then drop the existing one (making sure that you do take care of the data too).
解决方案是添加一个新列,然后删除现有的列(确保您也处理数据)。
回答by Shariar Imtiaz
As modifying existing column to identify column is not supported. So you can use below query to add new column.
因为不支持修改现有列来标识列。所以你可以使用下面的查询来添加新列。
ALTER TABLE students ADD (S_ROLL_NEW NUMBER(3) GENERATED ALWAYS AS IDENTITY);