Oracle 11g-添加新列并设置为唯一 [英] Oracle 11g - add new column and set as unique
本文介绍了Oracle 11g-添加新列并设置为唯一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用Oracle 11g将新列设置为唯一列时,我遇到了一个问题.
I am facing a problem on how to set a new column to unique using Oracle 11g.
我尝试使用此代码,但出现错误:
I try to use this code but it getting error:
ALTER TABLE QAS_ASSIGNED_STATE ADD UNIQUE (cuid);
推荐答案
您应定义列的类型.像这样:
You should define column's type. Like this:
alter table
QAS_ASSIGNED_STATE
add
cuid number NULL;
,然后添加约束:
ALTER TABLE QAS_ASSIGNED_STATE ADD CONSTRAINT constraint_cuid UNIQUE (cuid );
这篇关于Oracle 11g-添加新列并设置为唯一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文