title: Select data from a temp table using java
body: <p>I have a SQL stored procedure which select some data and insert to a temp table.</p>
  
  <pre><code>    DECLARE @tmpTable TABLE ([record_Id] [int] NOT NULL)
      WHILE(@count&gt;0)
          BEGIN 
              INSERT INTO @tmpTable
              SELECT top 1 [record_Id] 
              FROM Table1 
          END
     select * from   @tmpTable
  </code></pre>
  
  <p>I used the following code to access the procedure</p>
  
  <pre><code> ResultSet rs=null;Statement stmt=null;
   String getFirstRec="EXEC prod1";
   stmt=con.createStatement();
   rs=stmt.executeQuery(getFirstRec);
  </code></pre>
  
  <p>When I run this it gives me an error saying " the statement did not return the result set". can anyone help me to resolve this</p>
  
  <p>Thanks</p>