create or replace function get_number_five
return number
is
begin
dbms_output.put_line('function get_number_five is invoked');
return 5;
end;
As we can see, this function just returns the number 5 and outputs some string to standard buffer. So, here is an example of function which not only returns the result, but also performs some action, in other words it has some side effect. We need this quality to trace the function executons.
Let's try to guess the result of the following code:
declare x number; p number; begin p :=5; x := nvl(p,get_number_five); end;