LIMIT / OFFSET in Oracle 11G
Deleted original answer, not viable
I feel this should be doable in a single SQL statement, but so far the combination of the need for a correlated subquery and the need for some sort of analytic function has made everything I tried fail.
Here's a procedural method that I think will do what you want:
DECLARE CURSOR t IS SELECT LEAD(contractid,4) OVER (PARTITION BY assetid ORDER BY lasttradedate ASC) lead_contractid FROM table1 FOR UPDATE;BEGIN FOR r IN t LOOP UPDATE table1 SET nextcontractid = r.lead_contractid WHERE CURRENT OF t; END LOOP;END;