Use literals

There are three literal types in DML expressions: numbers, strings, and dates. Each of these has a specific syntax.

Numbers are quoted using the usual English syntax of numbers: decimal digits and full stop decimal separator. Although not very readable for human beings, digits cannot be grouped when using large numbers: 2,147,483,648 is not legal in expressions, only 2147483648 is accepted. Leading and tailing zeros, when not significant, can be omitted or not: 000.31416, 0.31416, 0.3141600 and .31416 are all legal and refer to the same value.

A scientific notation with exponent and significand is also accepted. The “E notation” is used since superscript is not convenient to type in. Only zero significands are legal. This means for example that the Avogadro number 6.0221415´1023 is only accepted in the form .60221415E24, while 6.0221415E23 is rejected as syntax error.

Even if your numbers are related with quantities with units: amount of money, volume of beer… You should never quote those units in literals: a pint (imperial) is 568.26125 ml, but you should use only 568.26125 in expressions.

Strings are the basic unit of text in DML, unlike in some other programming languages, even a single letter is represented as a one-letter string. You can place almost any character in strings that you can type in, including reserved characters and non-roman characters, if your keyboard allows that.

To prevent the DML interpreter from recognizing reserved words in string literals, you must surround the text with double quotes "…". Here are some samples:

"the quick brown fox jumps over the lazy dog"
"μηνιν αειδε θεα Πηληϊάδεω Aχιληος"

An irritating characteristic of the quotes is that they are not special characters that appear only in computer programs. They are a part of any normal English text to indicate emphasis or that someone has spoken. The quotes in a literal string have a different meaning than the quotes that surround the literal.

Since there is only one key on your keyboard to make a quote, you can use a technique that is called escaping. In most computer languages, at least one character, called an escape character, is designated to have the power to remove the special significance from other special characters, such as quotes. In DML, this character is the backslash (\).

To prevent the integration engine server from thinking that it has prematurely reached the end of your string, you need to escape the quotes in your strings as shown in the following example:

"He said \"using quotes in strings is irritating\""

states the real string: He said “using quotes in strings is irritating”

In DML you can use the following escapes in string literals:

Escape Description
\" for double quote (")
\\ for real backslash (\)
\t for tabulation character
\r for carriage-return character (ASCII 0x0D)
\n for line-feed character (ASCII 0x0A), not the newline.

The remaining type of literal you can use in expressions is a date-and-time literal, usually named date literals. This literal is used to refer to a special moment in time; either just a day in the year, or a precise moment of that day.

Date literals are always surrounded by single quotes (') and are strictly formatted. Two variations are possible following a date and a time is stated, or only a date.

  • If you want to state the last day of 20th century, use:
    '2000-12-31' (December 31st, 2000)
  • For the very first second of the 21st century, use:
    '2001-01- 00::01'
  • Minutes and seconds can be omitted, so noon of 2006 Christmas day is:
    '2006-12-25 12'
  • Ten past noon on 2006 Christmas day is:
    '2006-12-25 12:10'
  • Date literals can be (optionally) augmented with fractions of seconds as in the following meaning 1 ms before Christmas:
    '2006-12-24 23:59:.9999'

The decimal fraction shall have from one to nine digits after the full stop separator making the literal at least 1ns precise.

Dates and times expressed by these literals are supposed to be GMT (or UTC) times or bare times where the time zone is not significant. You might also state the time zone if required, let’s consider noon of Independence Day in NYC:

'2006-07-04 12:00:-04'

Even if some parts of the date can be omitted (minutes, seconds, and time zone), leading zeros are always required: 7:23 AM is always written 07:23.

Related Links