Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/arel/visitors/oracle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def visit_Arel_Nodes_SelectStatement o
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (#{sql}) raw_sql_
WHERE rownum <= #{offset.expr.to_i + limit}
)
WHERE raw_rnum_ >= #{offset.expr.to_i + 1 } and rownum <= #{limit}
WHERE #{visit offset}
eosql
end

Expand Down
3 changes: 2 additions & 1 deletion test/visitors/test_oracle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ module Visitors
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT) raw_sql_
WHERE rownum <= 20
)
WHERE raw_rnum_ >= 11 and rownum <= 10
WHERE raw_rnum_ > 10
}
end

Expand Down