While the Oracle DB has some very powerful functionality, it also seems to be missing some very basic functionality. Many developers, including myself, have often struggled with paginating results from an Oracle query. Even after Googling, I find it difficult to find a straightforward solution. So here it is, taken from the implementation in the pretty amazing
Oracle Enhanced ActiveRecord Adapter for Ruby on Rails.