WITH T AS ( SELECT '1-34' AS A FROM DUAL UNION ALL SELECT '10-6' AS A FROM DUAL UNION ALL SELECT '11-9' AS A FROM DUAL UNION ALL SELECT '141' AS A FROM DUAL UNION ALL SELECT '151-1' AS A FROM DUAL UNION ALL SELECT '16-10' AS A FROM DUAL UNION ALL SELECT '16-12' AS A FROM DUAL UNION ALL SELECT '170-3' AS A FROM DUAL ) SELECT A FROM T ORDER BY TO_NUMBER(SUBSTR(A,1,DECODE(INSTR(A,'-',1,1),0,4,INSTR(A,'-',1,1))-1)) ,TO_NUMBER(DECODE(INSTR(A,'-',1,1),0,NULL,SUBSTR(A,INSTR(A,'-',INSTR(A,'-',1,1))+1,4)))