修改游标所在的表

DECLARE
v_header_id NUMBER;
CURSOR cur_part_list IS
SELECT *
 FROM ske_sys_part_list
FOR UPDATE NOWAIT;
BEGIN
FOR rec_part IN cur_part_list
LOOP
SELECT ske_sys_part_list_s.nextval
 INTO v_header_id
 FROM dual;
IF rec_part.header_id IS NULL THEN
UPDATE ske_sys_part_list
SET header_id = v_header_id
WHERE CURRENT OF cur_part_list;
END IF;
END LOOP;
--COMMIT;
END;

你可能感兴趣的:(游标)