SQL$HELP_OLD72.HLB  —  SET_CATALOG, Examples
    Example 1: Setting schema and catalog defaults for the default
    database

    In this example, the user attaches to the multischema corporate_
    data database, uses SET SCHEMA and SET CATALOG statements
    to change the defaults to catalog ADMINISTRATION and schema
    ACCOUNTING of the corporate_data database, and creates the table
    BUDGET in the schema ACCOUNTING.

    SQL> ATTACH 'FILENAME corporate_data';
    SQL> SHOW CATALOGS;
    Catalogs in database with filename corporate_data
        ADMINISTRATION
        RDB$CATALOG
    SQL>  SHOW SCHEMAS;
    Schemas in database with filename corporate_data
        ADMINISTRATION.ACCOUNTING
        ADMINISTRATION.PERSONNEL
        ADMINISTRATION.RECRUITING
        RDB$SCHEMA
    SQL> SET CATALOG 'ADMINISTRATION';
    SQL> SET SCHEMA 'ACCOUNTING';
    SQL> CREATE TABLE BUDGET (COL1 REAL);
    SQL> SHOW TABLES;
         BUDGET
         DAILY_HOURS
         DEPARTMENTS
         .
         .
         .
    SQL> --
    SQL> -- To see the qualified table names, set default
    SQL> -- to another schema and catalog.
    SQL> --
    SQL> SET CATALOG 'RDB$CATALOG';
    SQL> SET SCHEMA 'RDB$SCHEMA';
    SQL> SHOW TABLES
    User tables in database with filename corporate_data
         ADMINISTRATION.ACCOUNTING.BUDGET
         ADMINISTRATION.ACCOUNTING.DAILY_HOURS
         ADMINISTRATION.ACCOUNTING.DEPARTMENTS
         .
         .
         .

    Example 2: Setting a default catalog for a database with an alias

    In this example, the user attaches to the multischema corporate_
    data database using the alias CORP. Setting the default catalog
    allows you to shorten the table name because you can qualify it
    with just the schema.

    SQL> ATTACH 'ALIAS CORP FILENAME corporate_data';
    SQL> CREATE TABLE ACCOUNTING.PROJECT_7 (STATUS REAL);
    %SQL-F-DBHANDUNK, ACCOUNTING is not the alias of a known database
    SQL> --
    SQL> -- You cannot qualify the table name without the alias,
    SQL> -- so SQL assumes ACCOUNTING is the alias, not the schema.
    SQL> -- Unless you want to qualify the table name with
    SQL> -- both alias and catalog names, you must set the
    SQL> -- default catalog to ADMINISTRATION, which
    SQL> -- contains ACCOUNTING. You must enable ANSI/ISO quoting to do this.
    SQL> --
    SQL> SET QUOTING RULES 'SQL92';
    SQL> SET CATALOG '"CORP.ADMINISTRATION"';
    SQL> CREATE TABLE ACCOUNTING.PROJECT_7 (STATUS REAL);
    SQL> SHOW TABLES;
    User tables in database with filename corporate_data
         ACCOUNTING.BUDGET
       .
       .
       .
         ACCOUNTING.PROJECT_7
         ACCOUNTING.WORK_STATUS
       .
       .
       .
Close Help