WITH menu AS ( SELECT '28nm' menu_nm FROM dual UNION ALL SELECT '40nm' FROM dual UNION ALL SELECT '65nm' FROM dual UNION ALL SELECT '90nm' FROM dual UNION ALL SELECT '110nm' FROM dual UNION ALL SELECT '130nm' FROM dual UNION ALL SELECT '180nm' FROM dual UNION ALL SELECT '350nm' FROM dual UNION ALL SELECT '500nm' FROM dual UNION ALL SELECT 'AAA' FROM dual UNION ALL SELECT 'BB' FROM dual ) SELECT menu_nm FROM menu ORDER BY CASE WHEN menu_nm LIKE '%nm' THEN LPAD(menu_nm, 7, ' ') ELSE menu_nm END ;