此过程现在插入异常后插入数据,但新问题是它在emp1表中插入两次相同的行。
CREATE OR REPLACE PROCEDURE proc1 IS
CURSOR b IS SELECT environment FROM emp;
v VARCHAR2(11);
BEGIN
OPEN c;
LOOP
FETCH b INTO v;
CASE v
WHEN 'a' THEN INSERT INTO emp1@testlink SELECT empno, name FROM emp
WHEN 'b' THEN INSERT INTO emp1@testlink1 SELECT empno, name FROM emp
END CASE;
END LOOP;
EXCEPTION
WHEN case_not_found THEN dbms_output.put_line('No data');
CLOSE b;
答案 0 :(得分:1)
如果您研究了错误消息,则可能确定错误与dblinks无关。以下是相关信息:
ORA-06592:
CASE not found while executing CASE statement
Cause: A CASE statement must either list all possible cases or have an else clause.
Action: Add all missing cases or an else clause
所以,你有“环境”的价值既不是'a'也不是'b'。如果其他值有效,则需要为它们添加案例,或者添加ELSE子句以使用某些默认操作捕获这些值。
case v
when 'a' then insert into emp1@testlink select empno, name from emp
when 'b' then insert into emp1@testlink1 select empno, name from emp
else <<do something here>>
end loop;