在创建表时已经定义了主键信息:create table productinfo1 (productid varchar2(10),productname varchar2(10),productprice number(8,2),quantity number(10),
category varchar2(10),origin varchar2(100),primary key (productid));
但是在我想删除该主键:alter table productinfo1 drop constraints productid;
提示不存在约束条件,请大神帮忙看看是什么原因
------解决方案--------------------
productid是主键的字段名称。删除约束时,drop constraints 加的是约束的名称
------解决方案--------------------
主键的名字不是productid,你没有指定主键名字则由系统自动命名的。你需要先查出主键名字:
select * from dba_constraints t where t.table_name='PRODUCTINFO1';
再删除。