【已解决】ORA-00001: unique constraint (USR_JXZX_DSJKF_MODEL.SYS_C00912833) violated

简介: 【已解决】ORA-00001: unique constraint (USR_JXZX_DSJKF_MODEL.SYS_C00912833) violated

问题

学号主键ID重复了

思路

Oracle 中,可以使用以下方法找出重复的主键:

  1. 使用 GROUP BY 和 HAVING 子句:使用 GROUP BY 子句按照主键列进行分组,并使用 HAVING 子句筛选出出现次数大于 1 的主键。
sqlSELECT primary_key_column, COUNT(*) 
FROM table_name 
GROUP BY primary_key_column 
HAVING COUNT(*) > 1;

再用 NOT IN 进行过滤

解决

执行成功


目录
相关文章
|
6月前
|
Oracle 关系型数据库 数据库
【已解决】ORA-00942: table or view does not exist
【已解决】ORA-00942: table or view does not exist
517 0
|
关系型数据库 MySQL 数据库
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
224 0
【ERROR】ERROR1: PROJ: proj_create_from_database: Cannot find proj.db
【ERROR】ERROR1: PROJ: proj_create_from_database: Cannot find proj.db
741 0
|
存储 关系型数据库 MySQL
ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1215 (HY000): Cannot add foreign key constraint
|
PHP
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
331 0
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
|
SQL
ORA-02292: integrity constraint (xxxx) violated - child record found
在更新表的主键字段或DELETE数据时,如果遇到ORA-02292: integrity constraint (xxxx) violated - child record found 这个是因为主外键关系,下面借助一个小列子来描述一下这个错误: SQL> create table studen...
2377 0