Subject Re: [firebird-support] Get the row number in a select
Author Fabiano Bonin
I have just figured out my own tricky way :-)

I think it's cheap, multi-user friendly and can be achieved using just
a simple select:

select
rdb$get_context('USER_TRANSACTION', 'row#') as row_number,
rdb$set_context('USER_TRANSACTION', 'row#',
coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer),
0) + 1),
a.rdb$relation_name
from
rdb$relations a
order by
a.rdb$relation_name