Execute oracle DDL script with functions from c# code
<p>I've some integration tests written in C# code using a Oracle Database. The test project has a CreateDatabase.sql that contains the DDL to create the entire database in each test execution.</p>

<p>When I had only sequences and tables, I was splitting the content of this file in <code>";"</code> char and executing each create statement separately, but now I've some functions and their statements contains some <code>;</code> chars in it, so I can't use this approach anymore.</p>

<p>I've checked on <a href="https://stackoverflow.com/questions/17725379/net-oracle-how-to-execute-a-script-with-ddl-statements-programmatically">.NET / Oracle: How to execute a script with DDL statements programmatically</a> question, but it did not help.</p>

<p>1) If I try to execute the entire file content in a single OracleCommand, I get an error <code>ORA-00911: invalid character</code> because of the <code>;</code> chars</p>

<p>2) If I try to wrap the file content in a <code>"begin {0} end;"</code> I get an error <code>PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: ...</code></p>

<p>3) I could try to parse the SQL file and put each statement inside a EXECUTE IMMEDIATE, but it will be harder...</p>

<p>Is there another option?</p>

<p>I'm using the Oracle.DataAccess version 4.112.3.0 to execute the commands.</p>

<hr>

<p><strong>EDIT</strong>
@kevinsky ask for a script, here it is a simplified example... the entire script create hundreds of objects...</p>

<pre class="lang-sql prettyprint-override"><code>CREATE SEQUENCE SQ_ARAN_SQ_ARQUIVO_ANEXO;

CREATE OR REPLACE FUNCTION UFC_SPSW_DISP_COMPOSICAO(p_id_composicao IN NUMBER) RETURN NUMBER
IS
   retorno NUMBER:= 0;
   numeroItens NUMBER;
   temDefinicao BOOLEAN := false;

   CURSOR item_cur is
    select idc.itdc_sq_item_definicao_composi, idc.insu_sq_insumo, idc.comp_sq_composicao, idc.itdc_nr_coeficiente, idc.COMP_DS_COMPOSICAO, idc.comp_sq_composicao_pai
    from item_definicao_composicao idc;
  BEGIN  
    FOR item_rec IN item_cur LOOP
      temDefinicao := true;
      IF (item_rec.itdc_nr_coeficiente is null) THEN
        RETURN null;
      ELSE
        IF (item_rec.insu_sq_insumo is null) THEN
          numeroItens := UFC_SPSW_DISP_COMPOSICAO(nvl(item_rec.comp_sq_composicao_pai, item_rec.comp_sq_composicao));
        else
          retorno := retorno + 1;
        END IF;
      END IF;
    END LOOP;
    IF (temDefinicao = false) THEN
       RETURN 0;
    END IF;
    RETURN retorno;
  END;

CREATE SEQUENCE SQ_CALC_SQ_CALCULO;
</code></pre>