title: Getting output from DBMS_OUTPUT.GET_LINES() using c#
body: <p>I know how to get output from  DBMS_OUTPUT.GET_LINE(). </p>
  
  <p>You can refer <a href="http://oradim.blogspot.com.tr/2007/05/odpnet-tip-retrieving-dbmsoutput-text.html" rel="nofollow">http://oradim.blogspot.com.tr/2007/05/odpnet-tip-retrieving-dbmsoutput-text.html</a></p>
  
  <p>On this page getting output form DBMS_OUTPUT.GET_LINES() method is also explained by using ODP.Net. Is there any way to manage this using only ADO.NET.</p>
  
  <p>For example, how can I read all outputs from below</p>
  
  <pre><code>begin 
   declare 
     stage number := 0; 
     begin
      DBMS_OUTPUT.PUT_LINE('STARTING:'); 
      INSERT INTO Country ( code, name) VALUES (1 , 'xxxx');
      INSERT INTO City ( code, name) VALUES (1 , 'yyyy');
      DBMS_OUTPUT.PUT_LINE('DONE:'); 
  COMMIT; 
  
  EXCEPTION  -- exception handlers begin 
    WHEN OTHERS THEN  -- handles all other errors 
     DBMS_OUTPUT.PUT_LINE('Error occured, rollback...');  
     DBMS_OUTPUT.get_LINE(:1, :2);
     stage := -1;
     ROLLBACK; 
    end;
  end; 
  </code></pre>
  
  <p>Output should be like this:</p>
  
  <pre><code>STARTING
  DONE
  </code></pre>
  
  <p>I have this code block, but it returns only first output line</p>
  
  <pre><code>using (OracleCommand cmd = cnn.CreateCommand())
  {
      OracleParameter status = new OracleParameter(":1", OracleType.VarChar, 32000);
      p_line.Direction = ParameterDirection.Output;
  
      OracleParameter line = new OracleParameter(":2", OracleType.Double);
      p_status.Direction = ParameterDirection.Output;  
  
      cmd.CommandText = script;
      cmd.CommandType = CommandType.Text;
      cmd.Parameters.Add(status);
      cmd.Parameters.Add(line );
      cmd.ExecuteNonQuery();
  
      string status = status.Value.ToString();
      string line = line.Value.ToString();
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>STARTING
  </code></pre>