SQL$HELP_OLD72.HLB  —  SET_ALIAS, Examples
    Example 1: Setting a default alias to avoid qualifying object
    names

    SQL> ATTACH 'ALIAS CORP FILENAME corporate_data';
    SQL> SET CATALOG 'ADMINISTRATION';
    SQL> SET SCHEMA 'PERSONNEL';
    SQL> SELECT LAST_NAME FROM EMPLOYEES;
    %SQL-F-NODEFDB, There is no default database
    SQL> --
    SQL> -- You must qualify the table name because you attached with an alias.
    SQL> --
    SQL> SELECT LAST_NAME FROM CORP.EMPLOYEES;
     LAST_NAME
     Ames
     Andriola
     Babbin
       .
       .
       .
    100 rows selected
    SQL> SET ALIAS 'CORP';
    SQL> --
    SQL> -- Now you do not need to qualify the table name EMPLOYEES.
    SQL> --
    SQL> SELECT LAST_NAME FROM EMPLOYEES;
     LAST_NAME
     Ames
     Andriola
     Babbin
       .
       .
       .
    100 rows selected

    Example 2: Changing the default alias

    Use the SHOW DATABASE statement to see the database settings.

    SQL> ATTACH 'FILENAME personnel';
    SQL> ATTACH 'ALIAS corp FILENAME corporate_data';
    SQL> --
    SQL> -- The default alias, RDB$DBHANDLE, refers to PERSONNEL
    SQL> -- to simplify references to CORPORATE_DATA make this
    SQL> -- database the default alias
    SQL> --
    SQL> SET ALIAS 'CORP';
       .
       .
       .
Close Help