在主键中增加一个字段出现ora-00955错误

将表mytable加上一个id2字段,并使其成为主键之一,原主键名为:mytable_pk,字段为(id),步骤如下:
1.删除主键:
alter table mytable drop constraint mytable_pk cascade;
2.增加字段
alter table mytable add id2 varchar2(6);
3.设置新增字段初值
update mytable set id2='sx';
4.将新增字段改为非空
alter table mytable modify id2 not null;
5.增加主键约束
ALTER TABLE mytable ADD CONSTRAINT mytable_PK PRIMARY KEY (id2,id);
ERROR 位于第 1 行:
ORA-00955: 名称已由现有对象使用
解决办法:
由于原表可能存在同名索引,因此先执行以下语句:
drop index mytable_pk;
再执行
ALTER TABLE mytable ADD CONSTRAINT mytable_PK PRIMARY KEY (id2,id);即可
参考:http://forums.oracle.com/forums/thread.jspa?messageID=1935536[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10249671/viewspace-1046997/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10249671/viewspace-1046997/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值