oracle查询报错:ORA-01427

2025-03-15 05:38:52
推荐回答(2个)
回答1:

子查询返回的可能是多条记录。
1)
select q.id from q where q.fzr like '%"+fullname+"%'

2)
select q.id from Pro as q where q.pid=(select q.id from q where q.fzr like '%"+fullname+"%')

你先执行1)再执行2),看看哪个返回的是多条记录。

你可以改成
select * from Work as p where p.pid in (select q.id from Pro as q where q.pid in (select q.id from q where q.fzr like '%"+fullname+"%'))

回答2:

ORA-01427:单行子查询返回多个行

因此,你要再加过滤条件或者做做其他处理,直到子查询的返回结果为单条记录为止。还不明白可以再问我。希望对你有所帮助。