I am getting ORA-01422: Exact fetch returns more than requested number of rows

610 pts.
Tags:
INSERT statement
ORA-01422
Oracle development
Oracle error messages
PL/SQL error messages
SELECT statement
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Inprise
    thanks it answered my question
    610 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following