Take the 2-minute tour ×

We have our own DataAccess library built upon the Microsoft Enterprise Data Access block.

I have stored procedure that takes binary file content as input parameter and store it into DB.

byte[] imageFileByteArray = this.GetByteArrayFromFile(imageFile);
this.dataAccess.AddCmdParameter("DOCIMAGE", System.Data.DbType.Binary, imageFileByteArray);

This code is working fine when using SQL database, But when I switched to Oracle, I get the exception saying that "Wrong type of parameter"

In oracle db, the DOCIMAGE column is declared as BLOB field.

Why inferred Dbtype.Binary is not working for oracle?

share|improve this question
add comment

2 Answers

You will need to use an OracleParameter, with the OracleType enum value Blob, see here for more...


share|improve this answer
As i have mentioned, we are using our own DAL dll which doesn't accept explicit OracleType other than DbType. –  vijay Oct 25 '12 at 12:18
add comment

This is probably to do with different Oracle inference of OracleDbType from System.Data.DbType. The System.Data.DbType.Binary has coresponding OracleDbType=Raw. You would have to use System.Data.DbType.Object to get OracleDbType=Blob, for more details see Table 3-3 in http://docs.oracle.com/html/B14164_01/featOraCommand.htm

share|improve this answer
I tried, and I get this following error."Cannot bind type System.Byte[] as Blob." But in this post says, he got it working after changing it from DbType.Object to DbType.Binary. Either way it is not working for me. Any suggestions? –  vijay Oct 25 '12 at 12:30
add comment

Your Answer


