SQL$HELP72.HLB  —  GET_ENVIRONMENT, Examples
    Example 1: Using the GET ENVIRONMENT Statement

    $ emp_id = "00164"
    $ SQL$
    SQL> ATTACH 'FILENAME MF_PERSONNEL';
    SQL> DECLARE :e CHAR(5);
    SQL> GET ENVIRONMENT :e = emp_id;
    SQL> SELECT last_name, first_name FROM employees WHERE employee_id = :e;
     LAST_NAME        FIRST_NAME
     Toliver          Alvin
    1 row selected
    SQL> ROLLBACK;

    Example 2: Using the SESSION option

    This example uses the SESSION option to save the DIALECT and
    restore it upon completion of the SQL script.

    SQL> declare :Rdb_DIALECT char(10);
    SQL> get environment (session) :Rdb_DIALECT = DIALECT;
    SQL> set dialect 'SQL92';
    SQL> -- get SQL92 semantics for UNIQUE constrain
    SQL> create table T (a integer unique);
    SQL> set dialect :Rdb_DIALECT;
    SQL> undeclare :Rdb_DIALECT;
Close Help