问题描述
我想在表中添加一列称为类别,但我尝试了几种选择,但不起作用
alter table attachments
add
(
category varchar2(20) not null check (category in ('default','agreement','security','information') DEFAULT 'default')
);
我也尝试这样的事情
ALTER TABLE attachments
ADD category ENUM ('default','information') DEFAULT 'default'
我在这里检查了几篇文章,但找不到任何解决方案。我在哪里弄错了?这是怎么了? 我收到消息
Error report -
ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
解决方法
您可以这样表达:
alter table attachments
add category varchar2(20)
default 'default'
check (category in ('default','agreement','security','information'))
not null
;