Home > Blockchain >  "ORA-00933: SQL command not properly ended" C# and Oracle
"ORA-00933: SQL command not properly ended" C# and Oracle

Time:01-20

I'm trying to run a SQL query in my Oracle database using C# (Dapper Library), I made some adaptations to make it work, and I had no problems with queries like update and select, however, when trying to insert, I'm getting the error

ORA-00933 : SQL command not properly ended

Here is the query

insert into Car_Names (Model, Descr) 
values (:Model, :Descr);

And an image with more information

Originally, the library would have sent column names with braces, e.g.

insert into ... ([column], [column2]) ...

But I was getting another error so I removed that rule.

CodePudding user response:

The trailing semi-colon is something that is used in tools to indicate the end of a command, eg SQLcl, SQLPlus, SQL Developer etc.

Thus, when these tools see the semi-colon, they send the SQL statement to the database without the semi-colon. Thus with other drivers (C#, python, node, etc etc) you compose the SQL statement without it, ie

insert into Car_Names (Model, Descr) 
values (:Model, :Descr)
  • Related