Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 一般错误:1 OCISMTEXECUTE:ORA-00001:违反了唯一约束(HR.SYS\u C004023)?_Sql_Oracle_Oracle10g_Unique Constraint_Ora 00001 - Fatal编程技术网

Sql 一般错误:1 OCISMTEXECUTE:ORA-00001:违反了唯一约束(HR.SYS\u C004023)?

Sql 一般错误:1 OCISMTEXECUTE:ORA-00001:违反了唯一约束(HR.SYS\u C004023)?,sql,oracle,oracle10g,unique-constraint,ora-00001,Sql,Oracle,Oracle10g,Unique Constraint,Ora 00001,我可以识别错误消息,它是由于唯一值约束,我的表是“分支”,SYSUC004023来自何处。我已经检查了Branchs表,没有重复值。可能是什么问题 SYS_C004023从哪里来 这是一个系统生成的约束名称,Oracle在未明确命名的情况下创建约束时创建该名称,例如 create table mytable (col1 integer primary key); mytable上的主键约束将由系统生成,因为我没有明确地将其命名为: create table mytable (col1 inte

我可以识别错误消息,它是由于唯一值约束,我的表是“分支”,SYSUC004023来自何处。我已经检查了Branchs表,没有重复值。可能是什么问题

SYS_C004023从哪里来

这是一个系统生成的约束名称,Oracle在未明确命名的情况下创建约束时创建该名称,例如

create table mytable (col1 integer primary key);
mytable上的主键约束将由系统生成,因为我没有明确地将其命名为:

create table mytable (col1 integer constraint mytable_pk primary key);
select table_name
from all_constraints
where owner = 'HR'
and constraint_name = 'SYS_C004023';
select column_name
from all_cons_columns
where owner = 'HR'
and constraint_name = 'SYS_C004023';
您可以通过以下方式找到此约束所在的表:

create table mytable (col1 integer constraint mytable_pk primary key);
select table_name
from all_constraints
where owner = 'HR'
and constraint_name = 'SYS_C004023';
select column_name
from all_cons_columns
where owner = 'HR'
and constraint_name = 'SYS_C004023';
您可以找到它使哪些列变得独特,如下所示:

create table mytable (col1 integer constraint mytable_pk primary key);
select table_name
from all_constraints
where owner = 'HR'
and constraint_name = 'SYS_C004023';
select column_name
from all_cons_columns
where owner = 'HR'
and constraint_name = 'SYS_C004023';
没有重复的价值


不,不会的,多亏了限制。有一次插入或更新行的尝试失败,从而违反了唯一性约束。

非常感谢您的回答,就像我从mysql表复制了一些10-20条记录到oracle…主ID从1-20。但是,我也添加了序列,从1开始,所以我认为,这就产生了问题,当我截断所有内容并再次插入时,它起作用了…唷。。