Mimer SQL Reference Manual TOC PREV NEXT INDEX

Mimer Developer Site

www.mimer.com/developer


Literals


Literal values may be given for any of the data types supported in SQL statements, wherever the term "literal" appears in the syntax diagrams.

String Literals

String literals may be represented in two ways, as character strings or hexadecimal strings.

Note: An empty string (i.e. '') is a defined value. It is not NULL.

For character and hexadecimal string literals, a separator may be used within the literal to join two or more substrings. Separators are described in Characters.

This is particularly useful when a string literal extends over more than one physical line, or when control codes are to be combined with character sequences.

Examples

ASCII codes are used for the hexadecimal literals:

String
Value
'ABCD'
ABCD
'Mimer''s'
Mimer's
'data'<LF>'base'
database
X'0D0A09'
<CR><LF><TAB>
X'0D0A'<LF>'09'
<CR><LF><TAB>

Note: Since the SQL92 standard states that a hexadecimal string is a bit-string and Mimer SQL currently does not support a BIT data type, it is advisable to explicitly type cast hexadecimal strings to the CHARACTER data type to assure forward compatibility. This is done with the CAST specification described in Assignments.

Numerical Integer Literals

A numerical integer literal is a signed or unsigned number that does not include a decimal point. The sign is a plus (+) or minus (-) sign immediately preceding the first digit.

In determining the precision of an integer literal, leading zeros are significant (i.e. the literal 007 has precision 3).

Examples:

Numerical Decimal Literals

A numerical decimal literal is a signed or unsigned number containing exactly one decimal point.

In determining the precision and scale of a decimal literal, both leading and trailing zeros are significant (i.e. the literal 003.1400 has precision 7, scale 4).

Examples:

Numerical Floating Point Literals

Floating point literals are represented in exponential notation, with a signed or unsigned integer or decimal mantissa, followed by an letter E, followed in turn by a signed or unsigned integer exponent.

The base for the exponent is always 10. The exponent zero may be used. The case of the letter E is irrelevant.

In determining the precision of a floating point literal, leading zeros in the mantissa are significant (i.e. the literal 007E4 has precision 3).

Examples:

DATE, TIME and TIMESTAMP Literals

A literal that represents a DATE, TIME or TIMESTAMP value consists of the corresponding keyword shown below, followed by text enclosed in single quotes ('').

The following formats are allowed:

DATE 'date-value'

TIME 'time-value'

TIMESTAMP 'date-value <space> time-value'

A date-value has the following format:

 year-value  -  month-value  -  day-value
 

A time-value has the following format:

 hour-value  :  minute-value  :  second-value
 

where second-value has the following format:

 whole-seconds-value [. fractional-seconds-value]
 

The year-value, month-value, day-value, hour-value, minute-value, whole-seconds-value and fractional-seconds-value are all unsigned integers.

A year-value contains exactly 4 digits, a fractional-seconds-value may contain up to 9 digits and all the other components each contain exactly 2 digits.

Examples:

DATE '1997-02-19'

TIME '10:59:23'

TIMESTAMP '1997-02-14 10:59:23.4567'

TIMESTAMP '1928-12-25 23:59:30'

Interval Literals

An INTERVAL literal represents an INTERVAL value and consists of the keyword INTERVAL followed by text enclosed in single quotes, in the following format:

INTERVAL '[+ | -] interval-value' interval-qualifier

The interval-value text must be a valid representation of a value compatible with the interval data type specified by the interval-qualifier, see Named Interval Data Types.

Standard Compliance

This section summarizes standard compliance concerning literals.

Standard
Compliance
Comments
X/Open-95
SQL92
EXTENDED
The presence of a newline character (<LF>) between substrings in a character or hexadecimal string literal is not mandatory in Mimer SQL.
Hexadecimal string literals are of type BINARY because Mimer SQL does not support the BIT data type.



Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
dbtechnology@upright.se
Mimer SQL Reference Manual TOC PREV NEXT INDEX