Oracle implements MySQL-like find_in_set sorting, function decode:
by default7#zbphp.com
Refer to Cdsn's post: http://topic.csdn.net/t/20060124/08/4532718.html
Questions:
------------------------------------------------------------------------------------
In the SQL statement
Order by can be sorted in the order specified no
For example, record a field value NCH HCH ACS TWN ....
I let the records in the order of the above, OK?
Reply:
-------------------------------------------------------------------------------------
ORDER by DECODE (col, ' NCH ', ' 1 ', ' HCH ', ' 2 ', ' ACS ', ' 3 ', ' TWN ', ' 4 ', col)
That's probably the only way to go.
Description
"Col" indicates the name of the column to sort
' NCH ', ' HCH ', ' ACS ' and so on represent the specific data in the sorted column
"1", "2", "3" and so on indicate the specified order of the corresponding data.
Oracle implements MySQL's find_in_set sequencing!