Cannot serialize the DataTable. DataTable name is not set
<p>I need to export all datatables to individual XML files and I cannot export all the rows at once because of System.OutOfMemoryException if there is a huge table. So I tried to export N rows. However WriteXml throws an exception if I use paging syntax in query.</p>

<p>I've tested both queries in LINQPad, they are ok.</p>

<blockquote>
  <p>System.InvalidOperationException: Cannot serialize the DataTable.
  DataTable name is not set.</p>
</blockquote>

<pre><code>  // The first query causes exception
  string oraQueryGetTableData = "SELECT * FROM (SELECT t0.* FROM MY_TABLE t0) WHERE ROWNUM &lt;= 100";

  // The second query runs without any error
  //oraQueryGetTableData = "SELECT * FROM MY_TABLE";

  OracleCommand oraCommandGetTableData = new OracleCommand(oraQueryGetTableData, oraConnection);

  OracleDataReader oraReaderTableData = oraCommandGetTableData.ExecuteReader();

  DataTable dataTable = new DataTable();
  dataTable.Load(oraReaderTableData);

  // Exception might occur here
  dataTable.WriteXml(writer, true);  
</code></pre>

<p>What is the problem here or how can I fix this?</p>