Depending on the resultset attributes one of:
SELECT * FROM (
- SELECT *, ROWNUM rownum__index FROM (
+ SELECT *, ROWNUM AS rownum__index FROM (
SELECT ...
) WHERE ROWNUM <= ($limit+$offset)
) WHERE rownum__index >= ($offset+1)
or
SELECT * FROM (
- SELECT *, ROWNUM rownum__index FROM (
+ SELECT *, ROWNUM AS rownum__index FROM (
SELECT ...
)
) WHERE rownum__index BETWEEN ($offset+1) AND ($limit+$offset)
return <<EOS;
SELECT $sq_attrs->{selection_outer} FROM (
- SELECT $sq_attrs->{selection_outer}, ROWNUM $idx_name FROM (
+ SELECT $sq_attrs->{selection_outer}, ROWNUM AS $idx_name FROM (
SELECT $sq_attrs->{selection_inner} $sq_attrs->{query_leftover}${order_group_having}
) $qalias WHERE ROWNUM <= ?
) $qalias WHERE $idx_name >= ?
return <<EOS;
SELECT $sq_attrs->{selection_outer} FROM (
- SELECT $sq_attrs->{selection_outer}, ROWNUM $idx_name FROM (
+ SELECT $sq_attrs->{selection_outer}, ROWNUM AS $idx_name FROM (
SELECT $sq_attrs->{selection_inner} $sq_attrs->{query_leftover}${order_group_having}
) $qalias
) $qalias WHERE $idx_name BETWEEN ? AND ?
sql => '(
SELECT id, artist__id, bleh
FROM (
- SELECT id, artist__id, bleh, ROWNUM rownum__index
+ SELECT id, artist__id, bleh, ROWNUM AS rownum__index
FROM (
SELECT foo.id AS id, bar.id AS artist__id, TO_CHAR (foo.womble, "blah") AS bleh
FROM cd me
sql => '(
SELECT id, artist__id, bleh
FROM (
- SELECT id, artist__id, bleh, ROWNUM rownum__index
+ SELECT id, artist__id, bleh, ROWNUM AS rownum__index
FROM (
SELECT foo.id AS id, bar.id AS artist__id, TO_CHAR(foo.womble, "blah") AS bleh
FROM cd me
sql => '(
SELECT id, artist__id, bleh
FROM (
- SELECT id, artist__id, bleh, ROWNUM rownum__index
+ SELECT id, artist__id, bleh, ROWNUM AS rownum__index
FROM (
SELECT foo.id AS id, bar.id AS artist__id, TO_CHAR(foo.womble, "blah") AS bleh
FROM cd me
sql => '(
SELECT id, ends_with_me__id
FROM (
- SELECT id, ends_with_me__id, ROWNUM rownum__index
+ SELECT id, ends_with_me__id, ROWNUM AS rownum__index
FROM (
SELECT foo.id AS id, ends_with_me.id AS ends_with_me__id
FROM cd me
sql => '(
SELECT id, ends_with_me__id
FROM (
- SELECT id, ends_with_me__id, ROWNUM rownum__index
+ SELECT id, ends_with_me__id, ROWNUM AS rownum__index
FROM (
SELECT foo.id AS id, ends_with_me.id AS ends_with_me__id
FROM cd me
'(
SELECT owner_name, owner_books
FROM (
- SELECT owner_name, owner_books, ROWNUM rownum__index
+ SELECT owner_name, owner_books, ROWNUM AS rownum__index
FROM (
SELECT owner.name AS owner_name,
( SELECT COUNT( * ) FROM owners owner WHERE (count.id = owner.id)) AS owner_books
'(
SELECT me.id, owner__id, owner__name, bar, baz
FROM (
- SELECT me.id, owner__id, owner__name, bar, baz, ROWNUM rownum__index
+ SELECT me.id, owner__id, owner__name, bar, baz, ROWNUM AS rownum__index
FROM (
SELECT me.id, owner.id AS owner__id, owner.name AS owner__name, ? * ? AS bar, ? AS baz
FROM books me
'(
SELECT me.id, owner__id, owner__name, bar, baz
FROM (
- SELECT me.id, owner__id, owner__name, bar, baz, ROWNUM rownum__index
+ SELECT me.id, owner__id, owner__name, bar, baz, ROWNUM AS rownum__index
FROM (
SELECT me.id, owner.id AS owner__id, owner.name AS owner__name, ? * ? AS bar, ? AS baz
FROM books me
FROM (
SELECT me.name, me.id
FROM (
- SELECT me.name, me.id, ROWNUM rownum__index
+ SELECT me.name, me.id, ROWNUM AS rownum__index
FROM (
SELECT me.name, me.id
FROM owners me