Getting "too many rows" error inside a "for" cursor loop

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-06-14T21:13:26Z Indexed on 2010/06/14 21:22 UTC
Read the original article Hit count: 169

Filed under:
|
|
|
|

I have a trigger that contains two cursors loops, one nested inside the other like this:

FOR outer_rec IN outer_cursor
LOOP
  FOR inner_rec IN inner_cursor
  LOOP
     -- Do some calculations
  END LOOP;

END LOOP;

Somewhere in this it is throwing the following error:

ORA-01422: exact fetch returns more than requested number of rows

I've been trying to determine where it's coming from for an hour or so.. but should this error never happen?

Also.. I am assuming the inner loop automatically closes and opens itself again every time the outer loop goes the next record, i hope this is correct.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle