oracle查询报这个错误:single-row subquery returns more than one row

本文探讨了在执行特定的SQL更新语句时遇到的single-rowsubqueryreturnsmorethanonerow错误,并详细解释了该错误产生的原因,即两个表中相关字段的数据重复所导致的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数据库按照你的条件查询有多个重复的数据。
例如:

UPDATE "SYS_ROLE" A
SET A ."DEPT_ID" = (
    SELECT
        c."id"
    FROM
        "his_department_info" c
    WHERE
        c."dept_name" = A ."ROLE_NAME"

如果以上sql语句报single-row subquery returns more than one row的错误,说明 c表”dept_name” 和A 表.”ROLE_NAME” 的这两个字段 数据重复

org.springframework.dao.DataIntegrityViolationException: ### Error querying database. Cause: java.sql.SQLIntegrityConstraintViolationException: (conn=1968867) ORA-01427: single-row subquery returns more than one row ### The error may exist in file [D:\workfiles\YH\yh\04.Implement\middlplatform\lrs-platform\lrs-platform-service\lrs-platform-service-concert\target\classes\mapper\read\Bbw3ReadMapper.xml] ### The error may involve org.mohrss.lrs.lr.concert.mapper.read.Bbw3ReadMapper.queryMonthOrQuaryList-Inline ### The error occurred while setting parameters ### SQL: select ABBW30, BGZ711, AAE001, ABB9M1, ABB9M2, ABB9M3, AAB301, AAB004, ABB9MB, AAE030, AAE031, ABB9M4, ABB9M5, ABB9M6, AAE004, AAE005, BGC701, ABB9M7, ABB9M8, to_char(to_date(ABB9M9,'yyyyMMdd'),'yyyy-MM-dd') as abb9m9, ABB9M9 as abb9m9back, ABB9MA, AAE100, AAE013, AAE400, AAE011, BAE295, AAE017, AAE504, AAE036, (select aba429 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' and rownum = 1) as aba429, (select aba432 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' and rownum = 1) as aba432, (select aae707 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' and rownum = 1) as aae707, (select aba429 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' ) as fileName1List, (select aba432 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' ) as fileUrlList, (select aae707 from ba44 a where a.aba414 = b.abbw30 and aba428 != 'mp4' ) as fileId1List, (select aba429 from ba44 a where a.aba414 = b.abbw30 and aba428 = 'mp4' and rownum = 1) as videoName, (select aae707 from ba44 a where a.aba414 = b.abbw30 and aba428 = 'mp4' and rownum = 1) as videoId, case WHEN CEIL(to_date(ABB9M9,'yyyyMMdd') - SYSDATE) > 30 THEN 0 else 1 end as isSubmit from BBW3 b where bgz711 = ? and aab301 = ? ### Cause: java.sql.SQLIntegrityConstraintViolationException: (conn=1968867) ORA-01427: single-row subquery returns more than one row怎么解决?我希望能直接通过子查询获取文件列表存在java数组中
最新发布
03-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值