当我在我的 oracle SQL Developer 上运行以下过程时
create or replace
Procedure Table_Update
IS
s_id VARCHAR2(256 byte);
CURSOR C1 IS
SELECT A.SR_ID
FROM TABLE_2 B,TABLE_1 A
WHERE A.Primary_key=B.Primary_Key;
BEGIN
loop
open c1;
fetch c1 into s_id;
exit when C1%NOTFOUND ;
update TABLE_2 set SR_ID = s_id;
commit;
END LOOP;
CLOSE C1;
END;
table_1 和 table_2 具有相似的结构。我的要求是 table_1 中的 SR_ID 应该根据匹配的主键更新为 table_2。当我运行该过程时,我收到以下错误消息
Connecting to the database XXX.
ORA-06511: PL/SQL: CURSOR ALREADY OPEN
ORA-06512: at "Table_Update", line 7
ORA-06512: at "Table_Update", line 13
ORA-06512: at line 2
PROCESS EXITED.
Disconnecting from the database XXX.
我一遍又一遍地尝试这个,请帮助我
谢谢