oracle sorted in a fixed order

The project team statistical report needs to be sorted according to a fixed order of company names. This sorting is generally rarely used, but there is no way for special scenarios, but this laborious and cumbersome method can only be used.
Mainly use the oracle decode function
select
ORG_NAME AS "unit name",
QUANTITY AS "number of assets",
ASSET_ORI_VALUE as "asset value"
from STATISTICS_ASSET_VALUE_BY_ORG
order by decode(ORG_NAME,
'Company A',1,
'Company B',2,
' Company C', 3,
'Company D', 4,
'Company E', 5,
'Company F', 6
)

Guess you like

Origin blog.csdn.net/wujian_csdn_csdn/article/details/107380445