No more data to read from socket

前端 未结 2 1538
感动是毒
感动是毒 2020-12-06 20:18

My procedure looks like this:

Declare 
       cur_1        Sys_Refcursor;
       cur_2        Sys_Refcursor;
       v_1          VARCHAR2(30);
       v_2             


        
2条回答
  •  误落风尘
    2020-12-06 20:58

    As jonearles mentioned you should write this in one SQL statement.

    If you insist on using PL/SQL : you are doing way too much work yourself, declaring variables, open cursors, looping, assigning variables. Consider this PL/SQL:

    begin
      for c1 in (select * from tab1@dblink1)
      loop
        for c2 in (Select * from tab2@dblink1 where col1 = c1.col1 and col2 = c1.col2)
        loop
          insert into local.tab3 values (c1.col1,c1.col2,c2.col1,c2.col2);
        end loop;
      end loop;
    end;
    /
    

提交回复
热议问题