本文介绍了ORA-00933:SQL命令未正确结束-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 public void updateweeks(string getdate)
{
    string result = getdate.Substring(0, 10);
    OracleConnection con;
    OracleCommand cmd;
    con = new OracleConnection(strConnectionString);
    cmd = con.CreateCommand();
    cmd.CommandText = "UPDATE MO_T_WEEK_REPORT SET C_ISACTIVE ='N' where TO_CHAR(TO_DATE(C_DATE,'DD/MM/YY hh24:mi:ss'),'DD/MM/YY')=TO_CHAR(TO_DATE('"+result+"','DD/MM/YY hh24:mi:ss'),'DD/MM/YY');";
    con.Open();
    cmd.ExecuteNonQuery();
    con.Close();                                          
}

在上面的代码中引发"ORA-00933:SQL命令未正确结束"的异常.

In the above code to raise the Exception for "ORA-00933: SQL command not properly ended".

推荐答案

cmd.CommandText 的末尾删除分号,在此处:

Remove semi-colon at the end of the cmd.CommandText, here:

M/YY');";
      ^
      |
     here

这篇关于ORA-00933:SQL命令未正确结束-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 15:15