The ORDER BY clause sorts the rows fetched by a SELECT statement in either ascending or descending order. The SQL engine always uses unmasked values of the DDM-configured fields specified in the ORDER BY clause to perform the sorting operation.

Example

The following example illustrates the use of the ORDER BY clause with a DDM-configured field.

SELECT *
FROM pub.Customer 
ORDER BY Name;

In this example, Name is a DDM-configured field. The SQL engine processes the ORDER BY clause using the unmasked values of Name, regardless of your DDM privileges. However, the SELECT list of the query returns unmasked values of DDM-configured fields for authorized users and masked values for unauthorized users.