ORA-00933: SQL command not properly ended

后端 未结 11 877
遇见更好的自我
遇见更好的自我 2020-12-03 22:54

I\'m using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop, I am doing an insert:

insert into ps_tl_compleave_tbl values(\'2626899\'         


        
相关标签:
11条回答
  • 2020-12-03 23:34

    In Oracle the semi-colon ';' is only used in sqlplus. When you are using ODBC/JDBC, OLEDB, etc you don't put a semi-colon at the end of your statement. In the above case you are actually executing 2 different statements so the best way to handle the problem is use 2 statements instead of trying to combine into a single statement since you can't use the semi-colon.

    0 讨论(0)
  • 2020-12-03 23:34

    The issue may be that you have a parameter variable that is null being inserted into the query. That was what my problem was. Once I gave the parameter a default value of empty string, it worked.

    0 讨论(0)
  • 2020-12-03 23:38

    semi colon after the first insert?

    0 讨论(0)
  • 2020-12-03 23:48

    The ADO.NET OLE DB provider is for generic data access where you don't have a specific provider for your database. Use OracleConnection et al in preference to OleDbConnection for an Oracle database connection.

    0 讨论(0)
  • 2020-12-03 23:52

    Oracle SQL uses a semi-colon ; as its end of statement marker.

    you will need to add the ; after bother insert statments.

    NB: that also assumes ADODB will allow 2 inserts in a single call.

    the alternative might be to wrap both calls in a block,

    BEGIN
          insert (...) into (...);
          insert (...) into (...);
    END;
    
    0 讨论(0)
  • 2020-12-03 23:52

    Is the semicolon needed from OLE_DB ? It's not needed from most API's ?

    0 讨论(0)
提交回复
热议问题