Syntax

<character string literal> ::=

<quote> [ <character representation>... ] <quote>

[ { separator <quote> [ <character representation>... ] <quote> }... ]

<national character string literal> ::=

[ N ] <quote> [ <character representation>... ]

[ { separator <quote> [ <character representation>... ] <quote> }... ]

<guid literal> ::=

<binary string literal> ::=

X <quote> [ { <hexit> <hexit> }... ] <quote>

[ { separator <quote> [ { <hexit> <hexit> }... ] <quote> }... ]

<character representation> ::=

|

nonquote-character

<quote symbol>

<quote symbol> ::= <quote><quote>
<quote> ::= '
<hexit> ::= <digit> | A | B | C | D | E | F | a | b | c | d | e | f


Notes

The notation for embedding a quote in a character string literal is two quote characters without space between them.
The N prefix is needed to implicitly cast a literal to a national character string, but is optional if the assignment target is a national character string type.
Character string literals are comparable to any character string independent of the collation, and they are implicitly converted to the character set and collation of the target site in an assignment.
The character representation of a GUID literal shall conform to the format of a GUID value, see the example below. The GUID prefix is optional if the assignment target is a GUID type.
The V1 syntax of specifying a binary string literal as hexadecimal values inside square brackets is still supported, but the extension has been deprecated in favor of standard SQL syntax using the X prefix, and may be removed from a future version of NexusDB SQL.
Feature F271 "Compound character literals" provides the syntactical ability to split string literals onto multiple lines by separating each part with a line-feed.


Examples

Data Type

Literal Examples

CHAR

'A character string literal is a sequence of characters enclosed in single quotes.'

VARCHAR

'The quote character ( '' ) is embedded in a literal by using two quote characters.'

CLOB

'Character string literals are also used with CLOB types. '

'String literals may be split onto multiple lines like this example.'

NCHAR

N'In formal SQL:2003 syntax, national character string literals are prefixed with a N.'

NCHAR

'NexusDB SQL supports national character string literals without the N prefix.'

GUID

GUID '{E5C37F97-0F9F-47FB-8B55-30FDEC0026E1}'

BLOB

X'4E6578757344422056322069732061206772656174205244424D532E'


Conformance

SQL:2003 standard

NexusDB extensions

-

-

-

-

-

-

-

Core SQL

Feature F421 "National character"

Feature T041 "Basic LOB data type support"

Feature F271 "Compound character literals"

The N prefix in a national character string literal is optional

GUID literal

Binary literal notation with hexadecimal values inside square brackets

Home | Site Contents | Documentation | NexusDB Manual V4 | SQL Reference | SQL Language Elements | Literals