Processing of null values when order by is used in oracle: When oracle sorts query results, null values exist in the column to be sorted, specify the NULL value at the beginning or at the end of the www.2cto.com Keyword: Nulls First; Nulls Last default condition: null defaults to the maximum value (I .e., asc Ascending Order <small --> large>, the value of null is listed at the end; the value of desc is listed at the beginning in descending order <big --> small>. syntax supported by Oracle Order by 2. if Nulls first is specified, the null value is ranked first (whether asc or desc. if Nulls is set to last, the records with null values are placed at the end (whether asc or desc)
Syntax example: (Table: Tab_A columns with some null values Col_A) select * from Tab_A order by Tab_A. col_A (asc/desc) nulls first ------> the null value is at the beginning of select * from Tab_A order by Tab_A. col_A (asc/desc) nulls last ------> null values are placed at the end of the other method: When order by is used, Nvl, NVL2, Decode, case ..... when .... end; and other functions to process the null value of the column, for example: select * from Tab_A order by NVL (Tab_A. col_A, 'abc') (asc/desc );