Hi All,
Can sumone help me resloving this issue.......
i get a ORA 00936- missing expression error while inserting image(Blob) into Oracle 9i table. I hv odp.net installed on the client machine.
i have a table in Oracle 9i d/b.
Tablename: PhotoBlob
Column1 : id Number
Column2 : PhotoBlob BLOB
using System;
using System.Data;
using System.IO;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
String SourceLoc = "D:/Images/photo.jpg";
Oracle.DataAccess.Client.OracleConnection conn= new Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings["OracleConnString"].ConnectionString;
FileStream fs = new FileStream(SourceLoc, FileMode.Open,FileAccess.Read);
byte[] ImageData = new byte[fs.Length];
fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));
fs.Close();
Oracle.DataAccess.Client.OracleCommand cmd = new Oracle.DataAccess.Client.OracleCommand();
cmd.CommandText="Insert into TestBlob values(100,@param)";
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
Oracle.DataAccess.Client.OracleParameter param = newOracle.DataAccess.Client.OracleParameter();
cmd.Parameters.Add("blobtodb", OracleDbType.Blob,ImageData.Length,"PhotoBlob");
param.Value=ImageData;
cmd.ExecuteNonQuery(); //here i get ORA-00936 missing Expression error
please help me out.....guys. thnx!!

1 answers
I'm not very familiar with Oracle but I can see two possible problems with your INSERT statement:
1. You're not specifying the fields in the TestBlob database into which the values are to be inserted.
2. I'm not sure that Oracle supports 'named' parameters and, even if it does, it would be @blobtodb you'd want rather than @param. However, you can certainly specify parameters using placeholders (:1, :2 etc).
There are also problems with the way you're adding the parameter.
So, I'd try something like:
answered one month ago by:
6446