Created
October 28, 2014 18:38
-
-
Save nexocentric/f2f6dcf7186c117d04d6 to your computer and use it in GitHub Desktop.
Oracle SQL: Natural Numeric Sort Order By Clause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--========================================================== | |
-- order by natural sort order as in | |
-- 1, 2.. 10, 11 and not computer sort order | |
--========================================================== | |
ORDER BY | |
to_number(regexp_substr(CHAR_COLUMN,'^[0-9]+')), | |
to_number(regexp_substr(CHAR_COLUMN,'[0-9]+$')), | |
CHAR_COLUMN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment