Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Examples

RDB/VMS SQL SET_CATALOG — VMS RDB_4.1A

 SET CATALOG ---+-> catalog-string-literal ----+-> ;
                +-> catalog-parameter ---------+
                +-> catalog-parameter-marker --+

 SET CATALOG specifies the default catalog for a user session.

Additional information available:

Examples

Examples

 Example 1:  Setting a default alias to avoid qualifying object
 names.

 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, 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
          .
          .
          .

 By changing the default catalog and schema, you can see the
 fully qualified name of the new table:

 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
 When you attach using an alias other than the default alias, you
 must qualify the table name with the alias in addition to the
 catalog and schema names.

 If you specify the alias and catalog name together as a
 delimited identifier in the SET CATALOG statement, you need only
 qualify the object name with a schema name.  You must enable
 ANSI/ISO quoting rules to use a delimited identifier.

 In the following example, the schema ACCOUNTING, within the
 catalog ADMINISTRATION, belongs to the database with alias CORP.

 SQL> ATTACH 'ALIAS CORP FILENAME CORPORATE_DATA';
 SQL> SET ANSI QUOTING ON;
 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

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026