Svein,
this is amazingly smart solution. Took me like one hour to understand what is going on :-) I suggested window functions becausue I thought they would be most effective in solving this. Yes there can be holes in sequence in my data,but thank you for your time and proposing this solution!
