Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I don't see how we can be compliant if SQL92 says:
> The time of evaluation of the <datetime value function> during the
> execution of the SQL-statement is implementation-dependent.
> It says it has to be "during the SQL statement", or is SQL statement
> also ambiguous? Is that why Oracle did what they did?
Yes, you're finally seeing my issue: "SQL statement" isn't all that
well-defined a concept.
ISTM that the reported behavior of Oracle's pl/sql is *clearly* in
violation of SQL92: the body of a pl/sql function is a single <SQL
procedure statement> per SQL92 4.17, so how can they allow
current_timestamp to change within it?
It would be even more interesting to try the same function called
from another pl/sql function --- in that scenario, hardly anyone
could deny that the whole execution of the inner function is contained
within one statement of the outer function, and therefore
current_timestamp should not be changing within it.
regards, tom lane