Home > Software engineering >  SQL Error: ORA-00933: SQL command not properly ended. When using a simple insert
SQL Error: ORA-00933: SQL command not properly ended. When using a simple insert

Time:08-06

When trying to execute the following command through my ASP.NET application, the error SQL Error: ORA-00933: SQL command not properly ended is thrown.

The statement: insert into SOMETABLE (GROUPID, USERID, REMOVED) values ('00000000000000000000000000000000', '00000000000000000000000000000000', 0);

However, if I run the exact same statement directly against the DB using SQL Developer, it works.

All of the articles I've read about this involve statements using additional criteria like order by, join, etc.

My connection strings are correct, and other statements are executing fine.

I'm feeding the statement to the database using DbContext.Database.ExecuteCommand():

string command = "insert into SOMETABLE (GROUPID, USERID, REMOVED) values ('00000000000000000000000000000000', '00000000000000000000000000000000', 0);";

int result = context.Database.ExecuteSqlCommand(command);

Why is this happening, and how can I fix it?

CodePudding user response:

Remove semi-colon, here:

string command = "insert into SOMETABLE (GROUPID, USERID, REMOVED) values 
('00000000000000000000000000000000', '00000000000000000000000000000000', 0);";
                                                                           ^
                                                                           |
                                                                        here
  • Related