oracle8.1.6
select block_id
from (
select block_id, block_index
from blocks_blocks
where community_id = :community_id
order by block_index) b
where block_index > :block_index
and rownum <=1
select block_id
from (
select block_id, block_index
from blocks_blocks
where community_id = :community_id
order by block_index desc) b
where block_index < :block_index
and rownum <=1