BibleGateway.com Verse Of The Day

Wednesday, August 18, 2010

Oracle Sorting of NULL Values

Speaking of Oracle crap, a few weeks ago while working on this project, the question came up of how Oracle sorts NULL values in an ORDER BY clause. I looked it up, and learned something new. Hooray for learning new stuff. I didn't realize you can specify how to sort NULL's in your ORDER BY clause. You add "NULLS FIRST" or "NULLS LAST" like this....

SELECT * FROM sometable ORDER BY col1 ASC NULLS FIRST

No comments: