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
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s