Managing session scope for global variables

Create and manage global variables that you want to apply only to the current session.

About this task

Session scope variables override the default values of global variables.

The following conditions apply to session scope variables:
  • They can be Db2 built-in global variables or user-defined global variables.
  • They are active only for the current session and only when explicitly set.
  • Their values may be used in the normal processing of other SQL statements such as DELETE, INSERT, SELECT, or UPDATE.

Procedure

  1. On the DB2 Administration Menu (ADB2) panel, specify option P, and press Enter.
    Alternatively, issue the OPTIONS primary command on any Db2 Admin Tool panel.
    The DB2 Admin Options (ADB2P) panel is displayed.
  2. Specify option SV, and press Enter.
    The Session Scope Variables (ADBPPSV) panel is displayed, as shown in the following figure:
    Figure 1. Session Scope Variables (ADBPPSV) panel
    DB2 Admin               DD1A Session Scope Variables                      15:40
    Option ===>                                                                
     
     Use these variables to override global variables for     DB2 System: DD1A 
     this session.                                            DB2 SQL ID: ADM001 
          
       SV - Manage session scope variables                     
                                                              
      CSV - Create session scope variable control table    
      USV - Upgrade session scope variable control table      
                              
      Session scope variable control table:              
        Table schema  . . SYSADM     >                
        Table name  . . . GLOBALVAR         >
    
  3. Specify option SV, and press Enter.
    The Session Scope Variables in schema.table (ADBPPSV1) panel, as shown in the following figure.
    Figure 2. Session Scope Variables in schema.table (ADBPPSV1) panel
    DB2 Admin    DD1A Session Scope Variables in SYSADM.GLOBA  >   Row 1 to 2 of 2   
    Command ===>                                                   Scroll ===> CSR  
    
    Line commands:  U - Update  SET - Set variable  DEL - Delete  INS - Insert     
                    GV - Global variables                                                        
                                                                                        
    Select Schema   Name             Expression                                    
           *        *                *                                            
    ------ -------> ---------------> ----------------------------------------------        
           SYSIBMAD GET_ARCHIVE      Y                                             
           SYSIBMAD MOVE_TO_ARCHIVE  Y                                             
    ******************************* END OF DB2 DATA*******************************
    
  4. Use line commands to manage the session variables.