SQL$HELP_OLD72.HLB  —  CREATE  CATALOG  Examples
    Example 1: Creating a catalog for a database using an alias

    This example shows how an interactive user could attach to the
    sample database called personnel and create a catalog in that
    database. (You must use the personnel sample database created
    with the multischema attribute for this example.) Using an
    alias, the user distinguishes the personnel database from other
    databases that may be attached later in the same session.

    SQL> ATTACH 'ALIAS CORPORATE FILENAME personnel -
    cont> MULTISCHEMA IS ON';
    SQL> --
    SQL> -- SQL creates a default catalog called RDB$CATALOG in
    SQL> -- each multischema database.
    SQL> --
    SQL> SHOW CATALOG;
    Catalogs in database personnel
        "CORPORATE.RDB$CATALOG"
    SQL> --
    SQL> -- The SET QUOTING RULES 'SQL99' statement allows the use of
    SQL> -- double quotation marks, which SQL requires when you
    SQL> -- qualify a catalog name with an alias.
    SQL> --
    SQL> SET QUOTING RULES 'SQL99';
    SQL> CREATE CATALOG "CORPORATE.MARKETING";
    SQL> --
    SQL> SHOW CATALOG;
    Catalogs in database personnel
        "CORPORATE.MARKETING"
        "CORPORATE.RDB$CATALOG"

    Example 2: Creating a catalog in the database with the default
    alias

    This example shows a CREATE CATALOG clause used in an interactive
    CREATE DATABASE statement. In this example, the user creates a
    database without specifying an alias. Because the user is not
    attached to any other databases, the new database becomes the
    default alias.

    SQL> CREATE DATABASE FILENAME inventory
    cont> MULTISCHEMA IS ON
    cont> CREATE CATALOG PARTS
    cont> CREATE SCHEMA PRINTERS AUTHORIZATION DAVIS
    cont> CREATE TABLE LASER EXTERNAL NAME IS DEPT_2_LASER
    cont> (SERIAL_NO INT, LOCATION CHAR)
    cont> CREATE SCHEMA TERMINALS AUTHORIZATION DAVIS
    cont> CREATE TABLE TERM100 EXTERNAL NAME IS DEPT_2_TERM100
    cont> (SERIAL_NO INT, LOCATION CHAR);
    SQL> SHOW CATALOG;
    Catalogs in database with filename inventory
        PARTS
        RDB$CATALOG
    SQL> show schemas;
    Schemas in database with filename inventory
        PARTS.PRINTERS
        PARTS.TERMINALS
        RDB$SCHEMA
Close Help