Using DB2_REVERSE_NULL_ORDER

In Db2, NULL values are considered higher than any other values. By enabling NULL ordering, NULLS are considered as the smallest values in sorting. You can enable this new option by setting the DB2_REVERSE_NULL_ORDER registry variable to DB2_REVERSE_NULL_ORDER=TRUE. By default, the DB2_REVERSE_NULL_ORDER registry variable is set to FALSE.

To enable, set the registry variable DB2_REVERSE_NULL_ORDER to TRUE. By default, DB2_REVERSE_NULL_ORDER is set to FALSE.

The following examples illustrate the use of DB2_REVERSE_NULL_ORDER:
CREATE table t1 ( c1 integer, c2 char(1));
INSERT into t1 values
( 1, 'A'),( 2, NULL),( 3, 'C'),( 4, NULL),( 5, 'E');
With DB2_REVERSE_NULL_ORDER disabled, select * from t1 order by c2:
Table 1.
c1 c2
1 A
3 C
5 E
2 -
4 -
With DB2_REVERSE_NULL_ORDER enabled, the following table displays DB2_REVERSE_NULL_ORDER set to TRUE.
Table 2.
c1 c2
2 -
4 -
1 A
3 C
5 E