Literals serve to write values of any data type.

LITERALDESCRIPTIONDECLARATION SYNTAXEXAMPLE
integerdigits representing integer number[0-9]+95623
long integer

digits representing an integer number with absolute value even greater than 2 31, but less than 2 63

[0-9]+L?257L, or 9562307813123123L
hexadecimal integerdigits and letters representing an integer number in hexadecimal form0x[0-9A-F]+0xA7B0
octal integerdigits representing an integer number in octal form0[0-7]*0644
number (double)a floating point number represented by 64bits in double precision format.[0-9]456.123
decimaldigits representing a decimal number[0-9]+.[0-9]+D123.456D
double quoted stringstring 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 stringstring value/literal enclosed in single quotes; only one escaped character [\'] gets translated into corresponding char [']'…​anything except [']…​''hello\tworld\n\r'
listlist of expressions where all elements are of the same data type[ <element> (, <element>)* ]

[] for an empty list
[10, 16 + 1, 31] or ['hello', "world" ]
maplist of key-value mappings where all keys and all values are expressions of the same data type{ <key> β†’ (, <key> β†’ <value>)* }

{} for an empty map
{ "a" β†’ 1, "bb" β†’ 2 }
datedate valuethis mask is expected: yyyy-MM-dd2008-01-01
datetimedatetime valuethis mask is expected: yyyy-MM-dd HH:mm:ss2008-01-01 18:55:00


You cannot use any literal for the byte data type. If you want to write a byte value, you must use any of the conversion functions that return byte and apply it on an argument value.
For information on these conversion functions, see Conversion Functions.

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:

  1. Decimal value to a decimal field (correct and accurate)
// correct - assign decimal value to decimal field
myRecord.decimalField = 123.56d;
  1. Double value to a decimal field (possibly inaccurate)
// possibly inaccurate - assign double value to decimal field
myRecord.decimalField = 123.56;

The latter might produce inaccurate results.