SQL$HELP_OLD72.HLB  —  CREATE  CATALOG
    Creates a name for a group of schemas in a multischema database.

1  –  Environment

    You can use the CREATE CATALOG statement:

    o  In interactive SQL

    o  Embedded in host language programs to be precompiled

    o  As part of a procedure in an SQL module

    o  In dynamic SQL as a statement to be dynamically executed

2  –  Format

  CREATE CATALOG --> <catalog-name> -+
   +---------------------------------+
   +-+-------------------------------+->
     +---> create-schema-statement -++
     +-+-> schema-element -+--------+
       +---------<---------+

  catalog-name =

  -+------> <name-of-catalog> --------------+->
   |                                        |
   +-> " -> <alias>.<name-of-catalog> ->"  -+

  schema-element =

  -+-> create-collating-sequence-statement -+->
   +-> create-domain-statement -------------+
   +-> create-index-statement --------------+
   +-> create-sequence-statement -----------+
   +-> create-storage-map-statement --------+
   +-> create-table-statement --------------+
   +-> create-trigger-statement ------------+
   +-> create-view-statement ---------------+
   +-> grant-statement ---------------------+

3  –  Arguments

3.1  –  alias.name-of-catalog

    Specifies an optional name for the attach to the database. Always
    qualify the catalog name with an alias if your program or your
    interactive SQL statements refer to more than one database.
    Separate the name of the catalog from the alias with a period,
    and enclose the qualified name within double quotation marks.

3.2  –  catalog-name

    The name of the catalog definition you want to create. Use any
    valid SQL name that is unique among all catalog names in the
    database. For more information on catalog names, see the User_
    Supplied_Names HELP topic.

3.3  –  create-schema-statement

    For more information, see the CREATE SCHEMA statement.

3.4  –  schema-element

    One or more CREATE statements or a GRANT statement. For more
    information, see the CREATE SCHEMA statement.

4  –  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