Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Concatenation

Strings may be concatenated using the concatenation operator having the form

<expr> || <expr>

where <expr> is any expression that results in a string value.

It is an error to concatenate non-string values. Values may be converted to string using a cast to type string.

Examples


Concatenate two fields

# spq
values a || b
# input
{a:"foo",b:"bar"}
{a:"hello, ",b:"world"}
{a:"foo",b:123}
# expected output
"foobar"
"hello, world"
error("incompatible types")

Cast non-string values to concatenate

# spq
values "foo" || 123::string
# input

# expected output
"foo123"