该过程现在在我插入异常后插入数据,但新问题是它在 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;