610 pts.
 I am getting ORA-01422: Exact fetch returns more than requested number of rows
Hi experts,

I am getting this error when I run my test case for my PL/SQL procedure, which has select and insert statements only. Not clear where I would have went wrong, Please guide me where should I check exactly. Its popping up with this error message which i caught in a exception piece after insert statement.

Software/Hardware used:
ASKED: January 6, 2009  10:56 AM
UPDATED: April 19, 2013  5:29 PM

Answer Wiki:
That error occurs in a SELECT ... INTO statement, when your query returns more than one row. Check your where clause, and make the necessary changes in order to ensure just 1 row is returned. There is a predefined exception for that error. It is: too_many_rows. If you know your query could return more than 1 row in some cases, you should put an exception handler, something like this:
<pre>Begin
SELECT xx into l_xx
FROM table_x;
Exception
when too_many_rows then
' do something
End;</pre>
Last Wiki Answer Submitted:  April 19, 2013  5:30 pm  by  Michael Tidmarsh   11,390 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   11,390 pts. , carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

thanks it answered my question

 610 pts.