Question:
I am using the NULL value clause (NVL) pursuant to your notes on
husing NVL and
I wonder if the order by xxx nulls first clause can work as an
alternative?
Answer: Yes, in Oracle 8i and beyond, you can add nulls
first to the order by clause, when the order by
clause was extended to include an optional NULLS FIRST or NULLS LAST
clauses for this very type of situation.
select stuff
from
mytab
order by
dept_id asc nulls first;
The rows with the null values sort to the top with NULLS FIRST.
You can also use NULLS LAST when you're sorting in descending order
and you want the NULL rows to appear at the bottom of the report.