Oracle can use the Decode function to sort by custom order:
Select * from ( Select 'Nick' asItem fromDualUnion All Select 'Viki' asItem fromDualUnion All Select 'Glen' asItem fromDualUnion All Select 'Robin' asItem fromDualUnion All Select ' Total' asItem fromdual) Pre_tabOrder byDecode (item,'Viki',1,'Glen',2,'Robin',3,'Nick',4,' Total', About);
In addition, in the report development, it is often necessary to put total at the end, other items sorted by other sort (generally in normal ascending order), can be considered as two sorts of the same column, then you can:
Select * from ( Select 'Nick' asItem fromDualUnion All Select 'Viki' asItem fromDualUnion All Select 'Glen' asItem fromDualUnion All Select 'Robin' asItem fromDualUnion All Select ' Total' asItem fromdual) Pre_tabOrder byDecode (item,' Total',2,1), item;
Oracle Custom Order Ordering