23.02.2026 14:20, Adriano dos Santos Fernandes wrote:
>
> - A same-name declared LTT can be created in different routines and will
> be completely different LTTs
Yep.
> - The declared LTT is bound to the routine statement.
Routine statement and attachment, I believe -- so that concurrently
executed request clones have unique temporary datasets.
> For example, a
> declared LTT ON-COMMIT-PRESERVE-ROWS can be invoked recursively and
> still see the data of the previously invoked routine. Not only that,
> when the first called routine exits and is re-invoked, it still see the
> old data
Hmmmm. I supposed the most common use case is to start with the empty
DLTTs and fill them during execution. A requirement to truncate just
declared DLTTs (in this use case) looks weird to me.
We start every request with a closed declared cursors and
initialized/nullified declared variables, why declared temporary tables
should behave differently and inherit its data from the prior invocations?
From the other side, if every request resets its DLTTs, then I see no
point in the ON COMMIT clause at all -- but it exists in the SQL spec.
The standard seems to treat GTTs / CLTTs and DLTTs the same way from the
dataset lifetime perspective, only declaration is different. For DLTTs,
however, this is not the practice I've seen in other databases.
Dmitry