>I'm createing a function that takes three parameters lcAction, lcCurIdKey, lcNewIdKey. lcAction could be TOP, BOTTOM, NEXT, PREV. lcCurIdKey is the idkey I'm currently using and lcNewIdKey is the new idkey that I will use. The stored procedure should first move the record pointer to lcCurIdKey (and this is the part where I want to move the record pointer as fast as possible) and then do a FETCH NEXT or FETCH PRIOR to get the new idkey and return it to me in lcNewIdKey...
I see... not sure what you need this for, since a cursor will do this for you just fine... When I use cursors I generally just include the PK, make it read only, but scrollable... then you can move in your cursor which will give you the id.
Also, to do what you want (generically), how would you know which table to do this to? Anyway, mike showed you how to do this in message #
42770, so you should be on your way.
BOb