{"id":1073,"date":"2015-12-22T06:16:27","date_gmt":"2015-12-22T06:16:27","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1073"},"modified":"2015-12-22T06:16:27","modified_gmt":"2015-12-22T06:16:27","slug":"oracle-using-limit-with-rownum","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/oracle-using-limit-with-rownum\/","title":{"rendered":"Oracle Using Limit with ROWNUM"},"content":{"rendered":"<p>In Oracle if you want to limit the records based on ROWNUM(mostly while doing pagination) the between is not going to work.<\/p>\n<p><strong>Below Doesn&#8217;t work<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\"> \r\n SELECT Column1, Column2, ......., Column N  \r\n   FROM TableName\r\n  WHERE ROWNUM Between 5 AND 10; \r\n<\/pre>\n<p>The alternate for this is as Follows<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\"> \r\nSELECT * FROM\r\n (SELECT rows_to_page.*, ROWNUM rnum FROM\r\n   (SELECT Column1, Column2, ......., Column N  \r\n      FROM TableName\r\n     WHERE ROWNUM Between 5 AND 10) rows_to_page\r\n    WHERE ROWNUM &lt; end_offset) \r\n WHERE rnum &gt; start_offset;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In Oracle if you want to limit the records based on ROWNUM(mostly while doing pagination) the between is not going to work. Below Doesn&#8217;t work SELECT Column1, Column2, &#8230;&#8230;., Column N FROM TableName WHERE ROWNUM Between 5 AND 10; The alternate for this is as Follows SELECT * FROM (SELECT rows_to_page.*, ROWNUM rnum FROM (SELECT&hellip; <a href=\"https:\/\/codethataint.com\/blog\/oracle-using-limit-with-rownum\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-1073","post","type-post","status-publish","format-standard","hentry","category-queries-oracle-database-2"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1073"}],"version-history":[{"count":1,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1073\/revisions"}],"predecessor-version":[{"id":1074,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1073\/revisions\/1074"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}