DEALLOCATE SQLCONTEXT
Function
The DEALLOCATE SQLCONTEXT statement instructs the run-time client support libraries to delete all memory resources relating to an SQL Context.
Invocation
Embedded Mode P Dynamic Mode Interactive Mode
Syntax

host_variable_identifier | A valid single host variable identifier must resolve to the address of an SQL Context (an SAGContext structure).

Description
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 CONNX Embedded SQL. No call is made to the CONNX 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.
Limitations
All SQL connections must be closed before executing a DEALLOCATE SQLCONTEXT statement.
ANSI Specifics
The DEALLOCATE SQLCONTEXT statement is not part of the Standard.
CONNX Embedded SQL Specifics
See also the related Adabas SQL Gateway Embedded SQL statement: ALLOCATE SQLCONTEXT.
Here is an example on how to deallocate an SQL context:
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