# Exemplos de paginação

**Exemplo de entrada (JSON):**&#x20;

```
{
    "page" : 1,
    "pageSize" : 50
}
```

## **Oracle** <a href="#h_83a431a13f" id="h_83a431a13f"></a>

```sql
SELECT COL_A, COL_B
  FROM (SELECT COL_A,
               COL_B,
               row_number() over (order by COL_A) rn
          FROM XPTO.MY_TABLE )

WHERE rn BETWEEN {{ TOLONG(SUM(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize), 1)) }}


AND {{ TOLONG(MULTIPLY(message.page, message.pageSize)) }}
```

## **SQL Server** <a href="#h_7be7d57144" id="h_7be7d57144"></a>

```sql
SELECT col_a, col_b FROM myTabel 
ORDER BY col_a  
OFFSET {{ TOLONG(SUM(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize), 1)) }} ROWS

FETCH NEXT {{ message.pageSize}} ROWS ONLY 
```

## Data Bricks (managed Apache Spark) <a href="#h_518bdfce52" id="h_518bdfce52"></a>

```sparql
WITH CTEResults AS

( 

 SELECT *, ROW_NUMBER() OVER (ORDER BY query.col_1) AS RowNum FROM(

  select distinct

  col_1,

  col_2,

  col_3

  from mytable

 where << YOUR FILTERS HERE>>

 order by col_1) query

)

SELECT * FROM CTEResults

where RowNum > {{ TOLONG(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize)) }}

 and RowNum <= {{ TOLONG(MULTIPLY(message.page, message.pageSize)) }}Sp
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digibee.com/documentation/resources/pt-br/best-practices/paginations-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
