Literals

A literal represents a constant value of a particular type. eSQL provides a literal syntax for most simple types. Literals are mostly used in the WHERE clause in order to form conditions. They can also be used in the SELECT clause.

String

A string is a sequence of characters enclosed in single inverted commas.

'sample text'

Use two single inverted commas when you want to embed an inverted comma into a string:

'What''s going on?'

LongString

A LongString is a sequence of characters enclosed in single inverted commas, followed by the letter 'L.'

'sample text'L

Boolean

With Boolean literals, statements are made using logical values.

true

false

DateTime

The DateTime literal is comprised of date and time information that are independent of the locale, and is enclosed in single inverted commas. It follows the syntax yyyy-mm-dd hh:mm:ss. All data are optional, hence the times starting with the smallest time unit can be omitted.

datetime'2010-06-30 16:30'

datetime'2012-06-30 16:30'

datetime'2012'

For omitted data, the smallest possible value is used.

datetime'2012-06-30 16:30'

and

datetime'2012-06-30 16:30:00'

are synonymous.

datetime'2012'

and

datetime'2012-01-01 00:00:00'

are also synonymous.

LongDateTime

The LongDateTime literal only differs from the DateTime literal in that it follows the more precise syntax yyyy-mm-dd hh:mm:ss.sss and ends with the letter 'L.'

datetime'2012-06-30 16:30:15.111'L

ID Literal

An ID literal consists of the keyword 'id' followed by a 32-character string.

id'ABCDEF12345678901234567890123456'

Integer

An integer literal is one or several consecutive digits that are not enclosed by inverted commas and are not part of a decimal literal.

42

Long

A long literal is an integer literal followed by the letter 'L.'

42L

Decimal

A decimal literal is a fixed-point number that follows the syntax 'number.number E+-number'. The individual components of the syntax are optional.

3.14

.5

7 e14

5.5 e-42

Integer, long, and decimal literals can have a prefixed sign (+ or -).