Search code examples
sqloracle-databaseexecutescalarora-00911

Run multiple commands in one ExecuteScalar in Oracle


I have a batch of sql statements such as ...

insert into.... ; insert into.... ; delete .........;

etc

When i try to execute them against oracle it gives me this error (ORA-00911 Invalid Character)

now i can understand that this is because of the semicolon between the statements, i tried this on SQL Server and it worked but in Oracle no luck so far.

Is there a way to run multiple statements against oracle by using the ExecuteScalar or some other function?


DUPLICATE: How can I execute multiple Oracle SQL statements with .NET


Solution

  • Try wrapping with a BEGIN..END

    BEGIN insert into.... ; insert into.... ; delete .........; END;