Constants
A constant is a literal value.
SQL syntax
{IntegerValue
|FloatValue
|FloatingPointLiteral
|FixedPointValue
| 'CharacterString
'| 'NationalCharacterString
' |HexadecimalLiteral
| 'DateString
' |DateLiteral
|'TimeString
' |TimeLiteral
| 'TimestampString
' | TimestampLiteral |IntervalLiteral
| BINARY_FLOAT_INFINITY | BINARY_DOUBLE_INFINITY | -BINARY_FLOAT_INFINITY | -BINARY_DOUBLE_INFINITY | BINARY_FLOAT_NAN | BINARY_DOUBLE_NAN }
Constant | Description |
---|---|
|
A whole number compatible with For example: 155, 5, -17 |
|
A floating-point number compatible with the Examples: .2E-4, 1.23e -4, 27.03, -13.1 |
|
Floating point literals These are compatible with the 123.23F, 0.5d |
|
A fixed-point number compatible with the For example: 27.03 |
|
A character string compatible with String constants are delimited by single quotation marks. For example: 'DON''T JUMP!' Two single quotation marks in a row are interpreted as a single quotation mark, not as string delimiters or the empty string. |
|
A character string compatible with National string constants are preceded by an indicator consisting of either N'Here''s how!' Two single quotation marks in a row are interpreted as a single quotation mark. The contents of a national string constant may consist of any combination of:
ASCII characters and UTF-8 encoded characters are converted internally to their corresponding UTF-16 format Unicode equivalents. Escaped Unicode characters are of the form N'This is an \u0061' Is equivalent to: N'This is an a' The |
|
Hexadecimal literals Hexadecimal literals containing digits 0 - 9 and A - F (or a - f) are compatible with the 0xFFFAB0880088343330FFAA7 Or: 0x000A001231 Hexadecimal digits provided with an odd length are pre-fixed with a zero to make it even. For example, the value If you provide a character literal, the binary values of the characters are used. For example, the following demonstrates what is stored when inserting a hexadecimal literal and a character literal in a Command> INSERT INTO tabvb VALUES (0x1234); 1 row inserted. Command> INSERT INTO tabvb VALUES ('1234'); 1 row inserted. Command> SELECT colbin FROM tabvb; < 1234 > < 31323334 > 2 rows found. However, Oracle Database differs in that it only accepts character literals, such as '1234', and translates the character literal as a binary literal of 0x1234. As a result, |
|
A string of the format For example: '2007-01-27 12:00:00' The '2007-01-27' For |
|
Format: For example: DATE '2007-01-27' or DATE '2007-01-27 12:00:00' For TT_DATE '2007-01-27'. Do not specify a time portion with the The TimesTen also supports ODBC date-literal syntax. For example: {d '2007-01-27'}. See ODBC documentation for details. |
|
A string of the format For example: '20:25:30' The range is |
|
Format: For example: TIME '20:25:30' The Usage examples: INSERT INTO timetable VALUES (TIME '10:00:00'); SELECT * FROM timetable WHERE col1 < TIME '10:00:00'; TimesTen also supports ODBC time literal syntax. For example: {t '12:00:00'} |
|
A string of the format The range is from If you have a SELECT * FROM testable WHERE C1 = TIME '12:00:00' In this example, each |
|
Format: For example: TIMESTAMP '2007-01-27 11:00:00.000000' For The Use literal syntax to enforce TimesTen also supports ODBC timestamp literal syntax. For example: {ts '9999-12-31 12:00:00'} |
|
Format: For example: INTERVAL '8' DAY |
|
Positive infinity
|
|
Negative infinity
|
|
Non-numbers
|