ORA-06548: no more rows needed
The caller of a pipelined function does not need more rows to be produced by the pipelined function.
Catch the NO_DATA_NEEDED exception in an exception handling block.
This message is linked to the predefined exception NO_DATA_NEEDED, which makes it possible for Pipelined functions to respond to situations where the calling code no longer requires the full set of data being piped out.
In this situation, the loop inside the pipelined function does not run to completion, and code that would normally be executed following the loop is not reached.
This is important in situations where the pipelined function must perform some kind of clean-up code after the loop (such as releasing a file handle, closing a network connection or releasing some other finite resource).
Although there are many reasons why a statement could be terminated without reaching the completion of a pipelined function’s loop, the simplest way to produce this situation is with a limit on the number of rows being fetched.
select * from table(my_pipelined_function( ... )) where rownum <= 10;
Catching the NO_DATA_NEEDED exception inside the pipelined function allows the function to perform any clean-up needed after the loop.
Further explanation and examples can be found in a post on Tom Kyte’s Blog.