Skip to content

The Soql.NullOrder Enum

Jason Siders edited this page Jul 4, 2025 · 4 revisions

Indicates how null values should be processed in SOQL ORDER BY clauses.

Use this in conjunction with the Soql.SortOrder class's setNullOrder method.

Soql.SortOrder sortOrder = new Soql.SortOrder(
  Opportunity.CloseDate,
  Soql.SortDirection.DESCENDING
)?.setNullOrder(
  Soql.NullOrder.NULLS_FIRST
);
Soql query = DatabaseLayer.Soql.newQuery(Opportunity.SObject)
  ?.addOrderBy(sortOrder)
  ?.toSoql();

Values

  • NULLS_FIRST
  • NULLS_LAST
Clone this wiki locally