Usage of deterministic-clause
Andreas, March 26, 2019 - 9:42 am UTC
Thanks for the answer.
I mostly agree, especially on the fact that the majority of the functions is deterministic, although its not explicitly declared with the deterministic-clause.
If Oracle would generally treat all functions as being potentially non-deterministic and only allow deterministic functions in SQL-statements (which would be the correct handling in my opinion), then developers would have more reason to use the deterministic-clause.
(Or are there reasons to allow non-deterministic functions in SQL? Right now I cant think of any.)
Conclusio so-to-say: Watch out whether a function is deterministic before using it in an SQL-statement.
March 27, 2019 - 7:16 am UTC
then developers would have more reason to use the deterministic-clause
My cynical self thinks all that would happen is we'd see more "deterministic" keywords added to functions that have not truly been checked for determinism.
Watch out whether a function is deterministic before using it in an SQL-statement.
Yes indeed.
Caching demonstration
Dieter, March 28, 2019 - 3:07 pm UTC
with
function f(i varchar2) return varchar2 is
begin
return i||'-'||to_char(systimestamp,'HH24MISS:FF');
dbms_lock.sleep(0.5);
end;
select rownum, f(rownum) x, (select f(rownum) from dual) y
from dual
connect by level <= 10