Team Fly |
It is also common to nest functions within functions. Using the months_between example from Table 2-7, it would be possible to round the number of months between the two dates. The following statement and output illustrates this example.
SQL> select round(months_between('17-MAR-61','21-APR-62')) 2 from dual; ROUND(MONTHS_BETWEEN('17-MAR-61','21-APR-62')) ---------------------------------------------- -13
The inner function is evaluated first, and then the outer function is evaluated second. This is true for all nested functions and as this example illustrates, different function types can be combined. Pay special notice to the parentheses for the outer and inner functions. For illustration purposes, this example nests only one function within another. However, it is possible to nest many functions within each other. Just be careful; the order of the functions is important, and the complexity of debugging nested functions increases with each additional nested function.
Team Fly |