Valid characters in identifiers

In an SQL identifier, a letter can be any character in the alpha class that the locale defines. The alpha class lists all characters that are classified as alphabetic.

For more information about character classification, see The CTYPE category. In the default locale, the alpha class of the code set includes the ASCII characters in the ranges a to z and A to Z. SQL identifiers can use these ASCII characters wherever letter is valid in an SQL identifier.

In a nondefault locale, the alpha class of the locale also includes the ASCII characters in the ranges a to z and A to Z. It might also include non-ASCII characters, such as letters from non-Roman alphabets (such as Greek or Cyrillic) or ideographic characters. For example, the alpha class of the Japanese UJIS code set (in the Japanese UJIS locale) contains Kanji characters. When HCL® OneDB® products use a nondefault locale, SQL identifiers can use non-ASCII characters wherever letter is valid in the syntax of an SQL identifier. A non-ASCII character is also valid for letter as long as this character is listed in the alpha class of the locale.

In a nondefault locale, the alpha class of the locale might include non-ASCII characters, such as ideographic characters. When HCL OneDB products use a nondefault locale, SQL identifiers can use non-ASCII characters wherever letter is valid in the syntax of an SQL identifier. A non-ASCII character is also valid for letter as long as this character is listed in the alpha class of the locale.

The SQL statements in the following example use non-ASCII characters as letters in SQL identifiers:
CREATE DATABASE march�;

CREATE TABLE �quipement
   (
   code NCHAR(6),
   description NVARCHAR(128,10),
   prix_courant MONEY(6,2)
    );

CREATE VIEW ��_va AS
   SELECT num�ro, nom FROM abonn�s;
In this example, the user creates the following database, table, and view with French-language character names in a French locale (such as fr_fr.8859-1):
  • The CREATE DATABASE statement declares the identifier march�, which includes the 8-bit character , for the database.
  • The CREATE TABLE statement declares the identifier �quipement, which includes the 8-bit character , for the table, and the identifiers code, description, and prix_courant for the columns.
  • The CREATE VIEW statement declares the identifier ��_va, which includes the 8-bit characters and , for the view.
  • The SELECT clause within the CREATE VIEW statement specifies the identifiers num�ro and nom as columns in the projection list, and the identifier abonn�s for the table in the FROM clause. Both num�ro and abonn�s include the 8-bit character .

All of the identifiers in this example conform to the rules for specifying identifiers within a French locale. For these names to be valid, the database locale must support a code set that includes these French characters in its alpha class.

For the syntax and usage of identifiers in SQL statements, see the Identifier segment in the HCL OneDB Guide to SQL: Syntax.