The DEALLOCATE SQLCONTEXT statement instructs the run-time client support libraries to delete all memory resources relating to an SQL Context.
Embedded Mode P |
Dynamic Mode |
Interactive Mode |
host_variable_identifier |
A valid single host variable identifier must resolve to the address of an SQL Context (an SAGContext structure). |
The effect of a DEALLOCATE PREPARE statement is that the all resources associated with the specified SQL Context will be deleted.
This statement results in a call, at runtime, to the client support libraries provided by the Adabas SQL Gateway Embedded SQL. No call is made to the Adabas SQL Gateway Embedded SQL itself. The SAGContext structure itself is not deallocated - only the associated resources that have been created by the client support libraries in the course of activities related to that SQL Context.
An error will be returned if:
the SQL Context contains open connections
the host variable does not resolve to a valid address of a SQL Context
the SQL Context is currently already in use.
All SQL connections must be closed before executing a DEALLOCATE SQLCONTEXT statement.
The DEALLOCATE SQLCONTEXT statement is not part of the Standard.
See also the related Adabas SQL Gateway Embedded SQL statement: ALLOCATE SQLCONTEXT.
Example
A SQL context can be deallocated as follows:
exec sql begin declare section;
SAGContext sqlCtx;
exec sql end declare section;
exec sql allocate sqlcontext as :&sqlCtx
:
< other statements >
:
exec sql deallocate sqlcontext as :&sqlCtx