Uses of PER_STMT_EXEC memory duration
The PER_STMT_EXEC memory duration is useful for communications between UDRs, parallel execution, user-defined aggregates, and named memory, and for memory allocations within an end-of-statement callback (if you have information to pass to the callback).
Important: Any memory with a duration higher than
PER_COMMAND can have multiple threads access it. Consider whether
you need to handle concurrency issues for any PER_STMT_EXEC memory
you allocate. For more information, see Handling concurrency issues.
Several DataBlade
API constructor
functions allocate their DataBlade
API data
type structure with a PER_STMT_EXEC memory duration. The following
table lists DataBlade
API data
type structures that have a memory duration of PER_STMT_EXEC.
DataBlade API data type structure | DataBlade API constructor function | DataBlade API destructor function |
---|---|---|
Connection descriptor (MI_CONNECTION) | mi_open() | mi_close() |
Save-set structure (MI_SAVE_SET) | mi_save_set_create() | mi_save_set_destroy() |
Switching the current memory duration before one of the constructor
functions in Table 1 does
not change the PER_STMT_EXEC memory duration of the allocated DataBlade
API structure.
These data type structures are freed by their destructor function
or when execution of the current SQL statement completes. To retain
access to some of these DataBlade
API data
type structures after the statement completes, you must save them
at the per-session level.
Tip: The DataBlade
API supports
the ability to save information at a per-session level. This ability,
however, is an advanced feature of the DataBlade
API. For
more information, see Obtain a session-duration connection descriptor.