21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11<br />

Aggregate functions<br />

Aggregate functions operate on groups of records, rather than on individual records or variables. They are often<br />

used in combination with a GROUP BY clause.<br />

Available in: DSQL, PSQL<br />

Added in: <strong>2.1</strong><br />

LIST()<br />

Description: LIST returns a string consisting of the non-NULL argument values in the group, separated either<br />

by a comma or by a user-supplied delimiter. If there are no non-NULL values (this includes the case where the<br />

group is empty), NULL is returned.<br />

Result type: BLOB<br />

Syntax:<br />

LIST ([ALL | DISTINCT] expression [, separator])<br />

• ALL (the default) results in all non-NULL values to be listed. With DISTINCT, duplicates are removed,<br />

except if expression is a BLOB.<br />

• The optional separator argument may be a string literal, a parameter or a variable in versions<br />

up to <strong>2.1</strong>.3. Starting at <strong>2.1</strong>.4 it may be any string expression. This makes it possible to specify e.g.<br />

ascii_char(13) as a separator.<br />

• The expression and separator arguments support BLOBs of any size and character set.<br />

• Date/time and numerical arguments are implicitly converted to strings before concatenation.<br />

• The result is a text BLOB, except when expression is a BLOB of another subtype.<br />

• The ordering of the list values is undefined.<br />

Bug<br />

In versions <strong>2.1</strong>–<strong>2.1</strong>.3, the last part of the result is sometimes truncated. With a single-row set, this happens<br />

when the length gets somewhere above 4000. As the number of rows grows, the threshold climbs rapidly, so<br />

in practice this bug might not raise its head very often. It is fixed in <strong>2.1</strong>.4.<br />

121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!