Oracle order by: In the decode SQL statement, www.2cto.com order by can be sorted in the specified order. No, for example, NCH HCH ACS TWN .... order by decode (col, 'nch ', '1', 'hch', '2', 'acs', '3', 'twn', '4', col) col indicates the data found in a column. decode function usage in Oracle www.2cto.com meaning and explanation: decode (condition, value 1, return value 1, value 2, return value 2 ,... value n, RETURN value n, default value) the meaning of this function is as follows: IF condition = value 1 then return (translation value 1) ELSIF condition = value 2 then return (translation value 2 )...... ELSIF condition = value n then return (translation value n) else return (default value) end if www.2c To.com decode (field or field operation, value 1, value 2, value 3) the result of this function is that when the value of the field or field operation is equal to the value of 1, the return value of this function is 2. Otherwise, the return value is 3. Of course, the value 1, the value 2, and the value 3 can also be expressions. This function makes some SQL statements much easier to use: 1. Compare the select decode (sign (variable 1-variable 2),-1, variable 1, variable 2) from dual; -- take a smaller value sign () the function returns 0, 1, and-1 based on a value of 0, positive, or negative. For example, if the variable 1 is 10, and the variable 2 is 20, then sign (variable 1-variable 2) is returned) -1 is returned, and the decode decoding result is "variable 1", so that a smaller value is obtained.