ORA-00911: invalid character trying to execute multiple statements

G

Guest

I have the following code:

OracleCommand cmd = new OracleCommand( sql, connection );
cmd.ExecuteNonQuery();

Whenever I try to execute the following SQL, which works fine in Oracle's
SQL tool, I get the invalid character error. I tried removing the semicolon,
but then I got a different error.

truncate table tmp_as_stock;

insert into tmp_as_stock (
ITEM
, MODEL
, TYPE
)
select
ITEM
, MODEL
, TYPE
from
source.CI_STOCK

Any ideas? Is it possible to execute multiple statements with
ExecuteNonQuery or other function?
 
M

Marina

I don't know about oracle, in SQL server this would work if the statements
were separated by semicolon.

Also, ExecuteNonQuery is not at all the equivalent of query analyzer or any
other tools for other systems. It cannot do all that those can do. For
example, ExecuteNonQuery doesn't process GO statements. So you can't run an
arbitrary SQL script using that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top