Skip to content

Instantly share code, notes, and snippets.

@kllaudyo
Last active January 23, 2019 16:20
Show Gist options
  • Save kllaudyo/de6d19e93d28c08bb6c44cb3ed32dc04 to your computer and use it in GitHub Desktop.
Save kllaudyo/de6d19e93d28c08bb6c44cb3ed32dc04 to your computer and use it in GitHub Desktop.
Paginação Oracle
select x.*
from (
--aqui dentro vai o seu sql normalmente, com where e etc..
select /*+ FIRST_ROWS(25)*/ --aqui indice de velocidade do próprio oracle
nu_expediente,
row_number() over (order by dt_documento desc, co_seq_documento) rn --ordene pelo que deseja e também por algo único
from tb_documento
) x
where x.rn between 1 and 25 --aqui tu pagina, a pagina dois é 26 and 50
order by x.rn;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment