41.23 GET_ORDERBY_NULLS_SUPPORT Function

This function checks whether the current data source is enabled to specify a NULLS clause for sorting. While this is always true for local and REST-enabled SQL, some REST APIs may not support it.

Plug-in developers can use this function to determine whether a NULLS clause is possible for this data source and show or hide these options in their UI.

You can specify a NULLS FIRST or NULLS LAST clause if one of the following conditions is true:

  • You are working against the local database or a REST-enabled SQL Service.
  • The REST API disables pagination. You always fetch all rows and sort locally.
  • The REST API disables server-side ordering. You must fetch all rows and sort locally.
  • The REST API enables pagination, supports server-side ordering, and includes an ORDER BY NULLS clause.

Syntax

APEX_PLUGIN_UTIL.GET_ORDERBY_NULLS_SUPPORT (
  parameter_1 IN NUMBER,
  parameter_2 IN VARCHAR2,
  parameter_3 IN NUMBER )

Returns

This function returns an instance of APEX_EXEC.T_SUPPORTS_ORDERBY_NULLS_AS which indicates whether ORDER BY NULLS clauses are supported or how the REST API treats NULLS when ordering.

Table 41-29 GET_ORDERBY_NULLS_SUPPORT Returns

Return Description
wwv_flow_exec_api.c_orderby_nulls_flexible The data source supports ORDER BY NULLs clauses.
wwv_flow_exec_api.c_orderby_nulls_are_lowest The data source treats NULLs as the lowest values when sorting.
wwv_flow_exec_api.c_orderby_nulls_are_highest The data source treats NULLs as the highest values when sorting.
wwv_flow_exec_api.c_orderby_nulls_always_last The data source always orders NULLs last.
wwv_flow_exec_api.c_orderby_nulls_always_first The data source always orders NULLs first.

Example

DECLARE
    l_supports_orderby_nulls apex_exec.t_supports_orderby_nulls_as;
BEGIN
    l_supports_orderby_nulls := apex_plugin_util.get_orderby_nulls_support;

    IF l_supports_orderby_nulls = wwv_flow_exec_api.c_orderby_nulls_flexible THEN
        ...
    END IF;
END;