Is there a way to run an arbitrary sql script through ODP.NET? I'd like to do something like this:
SomeOracleObject.RunFile("myfile.sql");
In other words, I want to obviate the need for sqlplus.exe.
Is there a way to run an arbitrary sql script through ODP.NET? I'd like to do something like this:
SomeOracleObject.RunFile("myfile.sql");
In other words, I want to obviate the need for sqlplus.exe.
Here's a snippet of code I use to do exactly what you're asking.
using (OracleConnection conn = CreateConnection(confConnString))
{
try
{
using (OracleCommand cmd = conn.CreateCommand())
{
cmd.CommandText = scriptFileContents;
cmd.ExecuteNonQuery();
I have been looking for a similar solution to the problem. I posted on the Oracle forums for ODP.NET but it appears no one from Oracle actually participates in the forums. The closest thing I have seen to this is DevArt's dotConnect for Oracle's OracleScript class. Ideally I want the same functionality I have inside the SQL Server Management Objects, but for Oracle. If I had my choice, I would move back to SQL Server because of things like this - but it's not my choice to make. :(