Literals
Literals serve to write values of any data type.
Table 65.1. Literals
Literal | Description | Declaration syntax | Example |
---|---|---|---|
integer | digits representing integer number | [0-9]+ | 95623 |
long integer | digits representing an integer number with absolute value even greater than 231, but less than 263 | [0-9]+L? | 257L, or 9562307813123123L |
hexadecimal integer | digits and letters representing an integer number in hexadecimal form | 0x[0-9A-F]+ | 0xA7B0 |
octal integer | digits representing an integer number in octal form | 0[0-7]* | 0644 |
number (double) | a floating point number represented by 64bits in double precision format | [0-9]+.[0-9]+ | 456.123 |
decimal | digits representing a decimal number | [0-9]+.[0-9]+D | 123.456D |
double quoted string | string value/literal enclosed in double quotes; escaped characters [\n,\r,\t, \\, \", \b] get translated into corresponding control chars | "...anything except ["]..." | "hello\tworld\n\r" |
single quoted string | string value/literal enclosed in single quotes; only one escaped character [\'] gets translated into corresponding char ['] | '...anything except [']...' | 'hello\tworld\n\r' |
list of literals | list of literals where individual literals are of the same data type | [ <any literal> (, <any literal>)* ] | [10, 17, 31] or ['hello', "world" ] |
date | date value | this mask is expected: yyyy-MM-dd | 2008-01-01 |
datetime | datetime value | this mask is expected: yyyy-MM-dd HH:mm:ss | 2008-01-01 18:55:00 |
Important | |
---|---|
You cannot use any literal for the For information on these conversion functions, see Conversion Functions. |
Important | |
---|---|
Remember that if you need to assign a decimal value to a decimal field, you should use decimal literal. Otherwise, such number would not be decimal, it would be a double number. For example:
The latter might produce inaccurate results. |