ORA-00911: invalid character

I create two tables in my oracle database (11g) as follows:

create table "test" ("id" int); create table test ("id" int); 

Then there is a problem in my C # program:

  OracleConnection conn = new OracleConnection(-myConnectionString-); conn.Open(); OracleCommand command = new OracleCommand("select * from test;", conn); var v = command.ExecuteReader(); OracleCommand command = new OracleCommand("select * from \"test\";", conn); var v = command.ExecuteReader(); 

for command command.ExecuteReader () I have the error "ORA-00911: invalid character".

+50
c # system.data.oracleclient
Sep 04 '12 at 11:01
source share
5 answers

Delete (with a comma) from the end of the SQL string

+138
Sep 04 '12 at 11:05
source share

In case other people come here to learn how to include several statements in one command, you need to wrap your instructions in begin and end . This will stop incorrect character errors due to half-columns. For example:

 var command = new OracleCommand(@" begin select * from test; select * from test2; end;") 
+31
Aug 27 '13 at 3:12
source share

Why are you using a semicolon in a query ... This is simply perceived as an invalid character ..... You must remove the semicolon (;) from the query and do it like this:

  OracleConnection conn = new OracleConnection(-myConnectionString-); conn.Open(); OracleCommand command = new OracleCommand("select * from test", conn); var v = command.ExecuteReader(); OracleCommand command = new OracleCommand("select * from \"test\"", conn); var v = command.ExecuteReader(); 

Read more about this error here .

+1
04 Sep '12 at 11:05
source share

This is not this guy's problem, but hopefully this helps someone:

I often have this problem with single quotes hidden inside inline comments, for example:

 select foo from bar where /* some helpful comment with a "can't" or somesuch */ baz='qux' 

The unrivaled single quote in the commentary evokes all kinds of drama, and the oracle does not go out of its way to help you understand this.

+1
Feb 15 '13 at 16:36
source share

Replace the sqldatasource parameter ? to :Column_name in the delete , update and insert commands.

-one
Aug 6 '17 at 13:37 on
source share



All Articles