title: SQL: how to select next id given an id
body: <p>There is one table T ( id integer, primary key ( id). <br>
  I want a parameterized query that, given id i:<br>
  will return next consecutive id, <br>
  if i = biggest id in T, query should return the smallest id in T (cyclical)</p>