Oracle函数问题,报(ORA-01422: 实际返回的行数超出请求的行数

2025-03-22 17:12:18
推荐回答(3个)
回答1:

这说明
1.where staff_vs_group.emp_no = staff_dict.emp_no and rownum=1;
这个符合这个条件的记录不止一行,而且很多行
2.而distinct只能把同一字段相同内容的删掉,不同内容的不会删掉。
3.select into是隐式游标,只能传一个内容进去
4.当加上rownum=1,就是选取了第一行,也就是说只是一行,肯定不会有其他相异的内容。

回答2:

select into 只能处理返回一行的情况,在返回多行与没有返回数据的时候都会报错。

回答3:

ORA-01422: exact fetch returns more than requested number of rows
Cause: The number specified in exact fetch is less than the rows returned.
Action: Rewrite the query or change number of rows requested