This question raised a very interesting point; there seems to be a contradiction in the Oracle documentation on whether it\'s possible for %NOTFOUND
to be null
I think the part that's tripping you up is this:
If FETCH never executes successfully, the EXIT WHEN condition is never TRUE and the loop is never exited.
Somewhere in the past there must have been a code example which looked like this:
LOOP
FETCH c1 INTO name;
EXIT WHEN c1%NOTFOUND;
-- Do stuff
END LOOP;
Given this chunk of code, then the statement rings true. If the fetch never executes (fails), then %NOTFOUND will be null. The EXIT WHEN
condition will not evaluate to TRUE (null evaluates to false). Then, indeed, the loop will continue forever.