Applicability:
When oracle sorts the query results, the column to be sorted has a null value, and the NULL value must be specified at the beginning or end of the column.
Keywords: Nulls First; Nulls Last
Default Value: the default value of null is the maximum value (I .e., asc in ascending order <small --> large>. The value of null is at the end; desc in descending order <large --> small>, the null value is at the top)
Specify:
1. Syntax supported by Oracle Order
2. If Nulls first is specified, the null value of the record will be ranked first (whether asc or desc)
3. Specifying Nulls last indicates that the records with null values will be placed at the end (whether asc or desc)
Syntax example:( Table: Columns with some null values in Tab_A)
Select * from Tab_A order by Tab_A. Col_A (asc/desc) nulls first ------> the null value ranks first.
Select * from Tab_A order by Tab_A. Col_A (asc/desc) nulls last ------> the null value is placed at the end
Other methods:
In order by, use functions such as Nvl, NVL2, Decode, case... when... end; to process the null values of the column.
Example: select * from Tab_A order by NVL (Tab_A. Col_A, 'abc') (asc/desc );