执行此块时出现“ORA-01410:无效的 ROWID”异常。任何想法为什么?
DECLARE
CURSOR c_orders IS
SELECT * from orders FOR UPDATE OF no;
v_order_record c_orders%ROWTYPE;
BEGIN
OPEN c_orders;
LOOP
FETCH c_orders INTO v_order_record;
UPDATE orders SET no = 11 WHERE CURRENT OF c_orders;
EXIT WHEN c_orders%NOTFOUND;
END LOOP;
CLOSE c_orders;
END;
但是,如果使用 FOR IN 语法,一切正常:
DECLARE
CURSOR c_orders IS
SELECT * from orders FOR UPDATE OF no;
BEGIN
FOR rec IN c_orders
LOOP
UPDATE orders SET no = 11 WHERE CURRENT OF c_orders;
END LOOP;
END;