我编写了一个程序,它使用游标来更新这些表中的某些行-这是程序:
DECLARE
-- Local variables here
CURSOR s
IS
(SELECT UNIQUE *
FROM Sellers
WHERE ID_Seller NOT IN (SELECT ID_Seller
FROM Sellers NATURAL JOIN Sales));
s_rec Sellers%ROWTYPE;
BEGIN
-- Test statements here
OPEN s;
LOOP
FETCH s INTO s_rec;
EXIT WHEN s%NOTFOUND;
DBMS_OUTPUT.put_line (s_rec.ID_Seller);
DBMS_OUTPUT.put_line (s_rec.Salary);
updateSalary (s_rec.ID_Seller, s_rec.Salary - 50);
END LOOP;
CLOSE s;
END;
这是程序 updateSalary:
CREATE OR REPLACE PROCEDURE updateSalary (ID_S IN VARCHAR2,
newSalary IN FLOAT)
IS
BEGIN
UPDATE Sellers s
SET s.salary = newSalary
WHERE s.ID_Seller = ID_S;
END updateSalary;
运行程序时,它卡在更新命令上。程序有什么问题?