SQL$HELP72.HLB  —  Literals  Character String Literals
    SQL recognizes the following types of character string literals:

    o  A quoted character string to represent printable characters
       from the session's literal character set.

    o  A quoted character string qualified by the name of a character
       set. The string represents printable characters from the named
       character set.

    o  A national character string literal (an N followed by a quoted
       character string), represents printable characters from the
       national character set.

    o  A hexadecimal character string (an X followed by a quoted
       character string) represents printable and nonprintable ASCII
       characters.

1  –  Quoted Character String

    A quoted character string literal is a string of printable
    characters enclosed in single quotation marks. The maximum length
    of a character string is 1,024 octets. An unqualified character
    string must contain characters only from the literal character
    set of that session.

    The printable ASCII characters consist of:

    o  Uppercase alphabetic characters:

       A-Z

    o  Lowercase alphabetic characters:

       a-z

    o  Numerals:

       0-9

    o  Special characters:

       ! @ # $ % ^ & * ( ) - _ = + ` ~

       [ ] { } ; : " \ | / ? > < . ,

    For a list of the printable characters for DEC_MCS, see the
    OpenVMS documentation for users; for a list of printable
    characters for the other supported character sets, see the
    standard for that character set.

    Use a pair of single quotation marks to enclose a character
    string literal. If you use double quotation marks, an
    informational message is displayed, indicating that double
    quotation marks are nonstandard. Double quotation marks are
    passed as delimited identifiers if the quoting rules are set
    to ANSI/ISO SQL.

1.1  –  Qualified

    You can use a quoted character string literal qualified by
    the name of a character set. The character string must contain
    characters only from the named character set.

    A string literal qualified by a character set begins with an
    underscore (_),  followed by the name of a supported character
    set, and a quoted string. No blank spaces are allowed outside of
    the literal.

    The following example shows how to qualify character strings with
    DEC_MCS and with DEC_KANJI:

    _DEC_MCS'Blue'

    _DEC_KANJI'Blue'

    You can use a national character string literal, which is a
    quoted character string literal qualified by the national
    character set. The character string must contain characters only
    from the national character set.

    A national character string literal begins with the letter N
    followed by a quoted string. No blank spaces are allowed outside
    of the literal.

    The following example shows how to qualify a character string
    with the national character set:

    N'Blue'

2  –  Hexadecimal Character String

    A hexadecimal character string literal begins with an X
    followed by a string of up to 16 characters enclosed in single
    quotation marks. This type of string literal lets you represent
    nonprintable ASCII characters by specifying the hexadecimal value
    of the characters within the quotation marks.

    Each ASCII character requires 2 hexadecimal digits to represent
    it, so you must provide an even number of characters within
    the quotation marks. The only valid characters for hexadecimal
    character string literals are 0 through 9 and A through F
    (uppercase or lowercase).

    In the following example, the hexadecimal character string
    literal represents two delete characters; the ASCII hexadecimal
    value for a delete character is FF:

    X'FFFF'
Close Help