Literals
- Last Updated: May 15, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
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.
| 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: |
0
|
| DATE | 'yyyy-mm-dd' |
'2010-05-21'
|
| DATETIME | 'yyyy-mm-dd hh:mm:ss.SSSSSS' |
'2010-05-21 18:33:05.025'
|
| DECIMAL | n.f
where: n is the integral part. f is the fractional part. |
0.25
|
| 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 | 'hex_value' |
'000482ff'
|
| LONGVARCHAR | 'value' |
'This is a string literal'
|
| TIME | 'hh:mm:ss' |
'18:33:05'
|
| VARCHAR | 'value' |
'This is a string literal'
|