Isso pode ser feito facilmente usando uma função de janela:
select Name,
Value,
dense_rank() over (order by name) - 1 as idx
from table
order by Name;
select Name,
Value,
dense_rank() over (order by name) - 1 as idx
from table
order by Name;