background image
<< SQL language reference | column-Name >>

Rules for SQL92 identifiers

<< SQL language reference | column-Name >>
Derby Reference Manual
18
constraints- that are stored in a database. They are called dictionary objects because
Derby stores information about them in the system tables, sometimes known as a data
dictionary. SQL also defines ways to alias these objects within certain statements.
Each kind of identifier must conform to a different set of rules. Identifiers representing
dictionary objects must conform to SQL-92 identifier rules and are thus called
SQL92Identifier
s.
Rules for SQL92 identifiers
Ordinary identifiers are identifiers not surrounded by double quotation marks. Delimited
identifiers are identifiers surrounded by double quotation marks.
An ordinary identifier must begin with a letter and contain only letters, underscore
characters (_), and digits. The permitted letters and digits include all Unicode letters and
digits, but Derby does not attempt to ensure that the characters in identifiers are valid in
the database's locale.
A delimited identifier can contain any characters within the double quotation marks.
The enclosing double quotation marks are not part of the identifier; they serve only to
mark its beginning and end. Spaces at the end of a delimited identifier are insignificant
(truncated). Derby translates two consecutive double quotation marks within a delimited
identifier as one double quotation mark-that is, the "translated" double quotation mark
becomes a character in the delimited identifier.
Periods within delimited identifiers are not separators but are part of the identifier (the
name of the dictionary object being represented).
So, in the following example:
"A.B"
is a dictionary object, while
"A"."B"
is a dictionary object qualified by another dictionary object (such as a column named "B"
within the table "A").
SQL92Identifier
An SQL92Identifier is a dictionary object identifier that conforms to the rules of SQL-92.
SQL-92 states that identifiers for dictionary objects are limited to 128 characters and are
case-insensitive (unless delimited by double quotes), because they are automatically
translated into uppercase by the system. You cannot use reserved words as identifiers
for dictionary objects unless they are delimited. If you attempt to use a name longer than
128 characters, SQLException X0X11 is raised.
Derby defines keywords beyond those specified by the SQL-92 standard (see
SQL
reserved words
).
Example
-- the view name is stored in the
-- system catalogs as ANIDENTIFIER
CREATE VIEW AnIdentifier (RECEIVED) AS VALUES 1
-- the view name is stored in the system
-- catalogs with case intact
CREATE VIEW "ACaseSensitiveIdentifier" (RECEIVED) AS VALUES 1
This section describes the rules for using SQL92Identifiers to represent the following
dictionary objects.