Prash's Blog

Unable to bind parameter id that is oracle guid type raw using ODP.Net September 28, 2012

Filed under: Uncategorized — prazjain @ 7:10 pm
Tags: , , , ,

I have had this problem of trying to save a GUID in oracle as type RAW.

When using oracle version 11.2.0.3, there was no problem saving it the way it was.

Working version for 11.2.0.3 :

cmd.Parameters.Add(":id", OracleDbType.Raw, ourCombinedList.OrderBy(x => x.ID).Select(e => e.ID).ToArray(), ParameterDirection.Input);

But when we downgraded to oracle version 11.2.0.2, this threw an error, saying unable to bind parameter id (which was a type GUID) to oracle raw types.

Workaround version for 11.2.0.2 :

cmd.Parameters.Add(":id", OracleDbType.Raw, ourCombinedList.OrderBy(x => x.ID).Select(e => e.ID.ToByteArray()).ToArray(), ParameterDirection.Input);
Advertisements