SORTLINES

The SORTLINES function sorts the lines in a multiline TEXT value.

Return Value

TEXT or NTEXT

Syntax

SORTLINES(text-expression [A|D])

Arguments

text-expression

A multiline text expression whose lines SORTLINES sorts. When you specify a TEXT expression, the return value is TEXT. When you specify an NTEXT expression, the return value is NTEXT.

A
D

Specifies whether the sorting order should be ascending, or alphabetical (A), or descending, or reverse alphabetical (D). The default is A (ascending). The sort order is controlled by the NLS_SORT option.

Examples

Example 8-101 Sorting Text Lines

This example shows how to sort the lines in a multiline text value in a variable called MKTREGIONS.

The statement

SHOW mktregions

produces the following output.

New York
Boston
Atlanta
San Francisco

The statement

SHOW SORTLINES(mktregions)

produces the following output.

Atlanta
Boston
New York
San Francisco