Deletes a variable definition from interactive and dynamic SQL that was used for invoking stored procedures and for testing procedures in modules or embedded SQL programs.
1 – Environment
You can use the UNDECLARE statement: o In interactive SQL o In dynamic SQL as a statement to be dynamically executed
2 – Format
UNDECLARE --+-> <variable-name> ------+---> +---------- , <-----------+
3 – Arguments
3.1 – variable-name
Specifies the name of the local variables.
4 – Example
Example 1: Undeclaring variables in interactive SQL SQL> ATTACH 'FILENAME personnel'; SQL> SQL> DECLARE :X INTEGER; SQL> DECLARE :Y CHAR(10); SQL> SQL> BEGIN cont> SET :X = 100; cont> SET :Y = 'Active'; cont> END; SQL> PRINT :X, :Y; X Y 100 Active SQL> SHOW VARIABLES X INTEGER Y CHAR(10) SQL> UNDECLARE :X, :Y;