An iterator function
By default, a user-defined function returns one value; that is, it calculates its return value and returns only once to its calling SQL statement. User-defined functions that return their result in a single return to the calling SQL statement are called noncursor functions because they do not require a database cursor to be executed. For information about how to invoke noncursor functions, see Invoke a UDR in an SQL statement.
However, you can write a user-defined function that returns to
its calling SQL statement several times, each time returning a value.
Such a user-defined function is called an iterator function.
An iterator function is a cursor function because it
must be associated with a cursor when it is executed. The cursor holds
the values that the cursor function repeatedly returns to the SQL
statement. The calling program can then access the cursor to obtain
each returned value, one at a time. The contents of the cursor are
called an active set. Each time the iterator function
returns a value to the calling SQL statement, it adds one item to
the active set.
Restriction: You cannot use OUT parameters in iterator
functions.