Help with N1QL query using variables

Hi, I’m trying to write a query that will read data out in chunks through the day. This is how I would write it in Sql Server but I’m not sure if I can use variables with N1QL. Thanks. (I added a space after @ since new users can only mention 2 users in a post. lol)

declare @ Minutes int, @ Here int, @ There int, @ Records int = 1388

select
@ Minutes = date_part_str(now_str(),‘hour’) * 60 + date_part_str(now_str(),‘minute’)

select
@ Here = @ Minutes * @ Records,
@ There = @ Minutes * @ Records + @ Records + 1

select recordId
from Documents
where cultureCode = ‘en-US’
and recordId >= @ Here and recordId <= @ There

You can pass the values as named parameters or positional parameters

select recordId
from Documents
where cultureCode = ‘en-US’
and recordId >=  $startid and recordId <=  $endid;

Set the $startid, $endid.

If you need further help let us know how you executing. Query Workbench, cbq shell, REST API, which SDK will point to the right place how to set those.