skip to main content
Supported SQL functionality : SQL expressions : Literals
  

Try DataDirect Drivers Now

Literals

Literals are fixed data values. For example, in the expression PRICE * 1.05, the value 1.05 is a constant. Literals are classified into types, including the following:
*Binary
*Character string
*Date
*Floating point
*Integer
*Numeric
*Time
*Timestamp
The following table describes the literal format for supported SQL data types.
Table 16. Literal Syntax Examples
SQL Type
Literal Syntax
Example
BIGINT
n
where
n is any valid integer value in the range of the INTEGER data type
12 or -34 or 0
BOOLEAN
Min Value: 0
Max Value: 1
0
1
DATE
DATE'date'
'2010-05-21'
DATETIME
TIMESTAMP'ts'
'2010-05-21 18:33:05.025'
DECIMAL
n.f
where:
n
is the integral part
f
is the fractional part
0.25
3.1415
-7.48
DOUBLE
n.fEx
where:
n is the integral part
f is the fractional part
x is the exponent
1.2E0 or 2.5E40 or -3.45E2 or 5.67E-4
INTEGER
n
where n is a valid integer value in the range of the INTEGER data type
12 or -34 or 0
LONGVARBINARY
X'hex_value'
'000482ff'
LONGVARCHAR
'value'
'This is a string literal'
TIME
TIME'time'
'2010-05-21 18:33:05.025'
VARCHAR
'value'
'This is a string literal'
* Character string literals
* Numeric literals
* Binary literals
* Date and time literals
* Integer literals