title: No more data to read from socket
body: <p>My procedure looks like this:</p>
  
  <pre><code>Declare 
         cur_1        Sys_Refcursor;
         cur_2        Sys_Refcursor;
         v_1          VARCHAR2(30);
         v_2          VARCHAR2(30);
         v_3          VARCHAR2(30);
         v_4          VARCHAR2(30);
  Begin
         OPEN cur_1 for Select * from tab1@dblink1;
         Loop
             Fetch cur_1 into v_1, v_2;
             EXIT WHEN cur_1%NOTFOUND;   
             OPEN cur_2 for Select * from tab2@dblink1 where col1 = v_1 and col2 = v2;
             Loop
                 Fetch cur2 into v_3, v_4;
                 Exit when cur_2%notfound;    
                 INSERT INTO local.tab3 values (v_1,v_2, v_3, v_4);
             END Loop;
             close cur_2;
         End Loop;
         close cur_1; 
  END;
  </code></pre>
  
  <p>The abobe procedure compiles, but when I run it I get following error:</p>
  
  <blockquote>
    <p>No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    No more data to read from socket<br>
    ...(Few more 'No more data to read from socket')</p>
    
    <p>IO Error: Connection reset by peer: socket write error<br>
    Process exited.</p>
  </blockquote>
  
  <p>Interesting thing is when I comment out the entire inner loop the procedure runs without error. So I know something is wrong with the inner loop (I tried commenting only the insert statement inside the inner loop and got the same error).</p>
  
  <p>Both my <em>localdb</em> and <em>dblink1</em> databases have same version:</p>
  
  <blockquote>
    <p>Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production</p>
    
    <p>PL/SQL Release 11.2.0.1.0 - Production</p>
    
    <p>CORE    11.2.0.1.0      Production</p>
    
    <p>TNS for 64-bit Windows: Version 11.2.0.1.0 - Production</p>
    
    <p>NLSRTL Version 11.2.0.1.0 - Production</p>
  </blockquote>