Oracle order NULL LAST by default

No, there is no way to change the default behavior of NULLS FIRST and NULLS LAST:

NULLS LAST is the default for ascending order, and NULLS FIRST is the
default for descending order.


I can’t prove it’s impossible to change, but I cannot find such a feature in the places it is most likely to be implemented.

SQL Option The manual does not mention anything.

Parameter None of the nls parameters in V$PARAMETER control it: select * from v$parameter where name like '%nls%';

Hidden Parameter There’s no hidden parameter. I tried searching for anything
like %null% or %sort%, none of them appear relevant.

Locale Builder Oracle allows you to create your own custom sorting. It
has a lot of options, but none of them allow you to define how NULLs are sorted. Setting the Major Sort and Minor Sort numbers really high or low does not
change it (I was hoping that a NULL was implemented as a hard-coded small or large value). You can set the sort order for 0x0000, which is “NULL”, but that’s a different type of NULL.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)