简体   繁体   中英

ORA-00936: missing expression while executing in C#.

I am writing a function for inserting BLOB file in to ORACLE. While executing the code I am getting the error stating that ORA-00936: missing expression .

My Code:

public static void DatabaseFilePut(MemoryStream fileToPut, OracleConnection con)
    {
     try
      {
       byte[] file = fileToPut.ToArray();
       const string preparedCommand = @"INSERT INTO user_account_statement (statement_id,session_key,login_id,user_id,account_number,
       from_date,todate,ipaddress,
       create_date_time,STATEMENT_FILE) VALUES(1073,'fe79e0345986b5a439c26f731234868b53f877366f529',
       2335,'204254','108142',to_date('2014-08-23 16:45:06','yyyy-mm-dd hh24:mi:ss'),
       to_date('2014-08-23 16:45:06','yyyy-mm-dd hh24:mi:ss'),
       '106.79.126.249',to_date('2014-08-23 16:45:06','yyyy-mm-dd hh24:mi:ss'),file)";
       using (var sqlWrite = new OracleCommand(preparedCommand, con))
       {
        sqlWrite.ExecuteReader();
       }
      }
      catch (Exception ex)
       {
         MessageBox.Show(ex.ToString());
       }
    }

Please advise where I am going wrong.

I specified parameter for 'file'

sqlWrite.BindByName = true;
                var blobparameter = new OracleParameter
                {
                    OracleDbType = OracleDbType.Blob,
                    ParameterName = "ssfile",
                    Value = fileToPut.ToArray()
                };
                sqlWrite.Parameters.Add(blobparameter);

and changed parameter name too. because the parameter name file is ORACLE's reserved word. So it might create another problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM