title: Is it possible to execute a SQLPLUS script using ODP.NET (Oracle.ManagedDataAccess)?
body: <p>I've got a console app that connects to a database (using <code>Oracle.ManagedDataAccess</code>) and then tries to execute a bunch of <code>SQL*PLUS</code> scripts located on my local hard drive.</p>
  
  <p>Unfortunately although my app works for simple SQL Statements (<code>SELECTS</code>) it doesn't appear to work for <code>SQL*PLUS</code>.</p>
  
  <p>The Code:</p>
  
  <pre><code>    var script = File.ReadAllText("C:\\Automation\\script.sql");
  
      using (var objConn = new OracleConnection(_connectionString))
      {
          OracleCommand objCmd = new OracleCommand();
          objCmd.Connection = objConn;
          objCmd.CommandText = script;
          objCmd.CommandType = CommandType.Text;
  
          try
          {
              objConn.Open();
              objCmd.ExecuteNonQuery();
          }
          catch(Exception ex)
          {
              Console.WriteLine("Exception: {0}", ex.ToString());
          }
          finally
          {
              objConn.Close();
          }
      }
  </code></pre>
  
  <p><strong>Script.sql</strong>  - executes without error in SQL Developer</p>
  
  <pre><code>    DEFINE CODE_PATH = C:\Automation
      @"&amp;&amp;CODE_PATH\Test.sql"
  </code></pre>
  
  <p><strong>Test.sql</strong>  - executes without error in SQL Developer\my app without <code>SQL*PLUS</code></p>
  
  <pre><code>    SELECT ID FROM data.SOME_TABLE WHERE ROWNUM &lt; 100 
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>    ORA-00900: invalid SQL statement at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
  </code></pre>
  
  <p>What am I missing? Is this even possible?</p>