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
(B)0[m[1;4mCREATE[m[1m [1;4mCATALOG[m[1m qq> <catalog-name> qk [m [1m lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1m mqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwq> [m [1m tqqq> create-schema-statement qwj [m [1m mqwq> schema-element qwqqqqqqqqj [m [1m mqqqqqqqqq<qqqqqqqqqj [m [1m [m (B)0[m[1mcatalog-name = [m [1m [m [1mqwqqqqqq> <name-of-catalog> qqqqqqqqqqqqqqwq>[m [1m x x [m [1m mq> " q> <alias>.<name-of-catalog> q>" qj [m [1m [m (B)0[m[1mschema-element = [m [1m [m [1mqwq> create-collating-sequence-statement qwq> [m [1m tq> create-domain-statement qqqqqqqqqqqqqu [m [1mtq> create-index-statement qqqqqqqqqqqqqqu[m [1mtq> create-sequence-statement qqqqqqqqqqqu[m [1mtq> create-storage-map-statement qqqqqqqqu[m [1m tq> create-table-statement qqqqqqqqqqqqqqu [m [1m tq> create-trigger-statement qqqqqqqqqqqqu [m [1m tq> create-view-statement qqqqqqqqqqqqqqqu [m [1m mq> grant-statement qqqqqqqqqqqqqqqqqqqqqj [m [1m [m
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