I have a large table with some indexes.
And I have a value for an indexed field. So I'd like to get the order of the first entry of this value in a specified index.

I'd like to write a stored procedure, which returns such number for given value and index name.

How can I do it?