Identifies a collating sequence that has been defined using the OpenVMS National Character Set (NCS) utility. Use the CREATE COLLATING SEQUENCE statement to identify collating sequences other than the database default collating sequence that you plan to use with certain domains. (The default collating sequence for a database is established by the COLLATING SEQUENCE IS clause in the CREATE SCHEMA statement; if you omit that clause at database definition time, the default sequence is ASCII.) You must enter a CREATE COLLATING SEQUENCE statement specifying a collating sequence before you enter the name of that sequence in any of the following statements: o CREATE DOMAIN . . . COLLATING SEQUENCE o DROP COLLATING SEQUENCE o ALTER DOMAIN . . . COLLATING SEQUENCE o SHOW COLLATING SEQUENCE
1 – Environment
You can use the CREATE COLLATING SEQUENCE 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 COLLATING SEQUENCE <sequence-name> --+ +-----------------------------------------+ +--+-------------------------------------+--+ +-> STORED NAME IS <stored-name> -----+ | +-------------------------------------------+ +--+-----------------------------------+-+ +-> COMMENT IS --+-> '<string>' --+-+ | +------ / <------+ | +----------------------------------------+ +----> <ncs-name> +-----------------------+-> +-> FROM <library-name> +
3 – Arguments
3.1 – COMMENT_IS
Adds a comment about the collating sequence. SQL displays the text when it executes a SHOW COLLATING SEQUENCE statement in interactive SQL. Enclose the comment within single quotation marks (') and separate multiple lines in a comment with a slash mark (/).
3.2 – FROM library name
Specifies the name of an NCS library other than the default. The default NCS library is SYS$LIBRARY:NCS$LIBRARY.
3.3 – ncs-name
Specifies the name of a collating sequence in the default NCS library, SYS$LIBRARY:NCS$LIBRARY, or in the NCS library specified by the library-name argument. The collating sequence can be either one of the predefined NCS collating sequences or one that you defined yourself using NCS.
3.4 – sequence-name
Specifies the name by which the collating sequence named in the ncs-name argument is known to the schema. The ncs-name and sequence-name arguments can be the same.
3.5 – STORED_NAME_IS
Specifies a name that Oracle Rdb uses to access a collating sequence created in a multischema database. The stored name allows you to access multischema definitions using interfaces, such as Oracle RMU, the Oracle Rdb management utility, that do not recognize multiple schemas in one database. You cannot specify a stored name for a collating sequence in a database that does not allow multiple schemas.
4 – Example
Example 1: Creating a French collating sequence The following example creates a collating sequence using the predefined collating sequence FRENCH. It then shows the defined collating sequence by using the SHOW COLLATING SEQUENCE statement. SQL> CREATE COLLATING SEQUENCE FRENCH FRENCH; SQL> -- SQL> SHOW COLLATING SEQUENCE User collating sequences in schema with filename SQL$DATABASE FRENCH Example 2: Create a Spanish collating sequence specifying more than one comment SQL> CREATE COLLATING SEQUENCE SPANISH_COL cont> COMMENT IS 'first comment' / 'second comment' cont> SPANISH; SQL> SHOW COLLATING SEQUENCE SPANISH_COL; SPANISH_COL Comment: first comment second comment