Honestly this has been one of the strangest problems that came across me.
I have code that inserts geometries into oracle tables using stored procedures. Due to legacy reasons I'm still using WKB to get the job done, therefore the procedure parameters are of type BLOB.
Recently when inserting a given polygon, I has blown by the ORA01460 error. Browsing the net just pointed me to the parameter value length.
But, then the byte array length was not that strange. It's an 32646 bytes length array! So why the error ?
Further investigation shows that I was successfully passing larger and smaller array to the stored procedure. Things were getting event stranger...
My first shot was truncating the array, and it worked (got an error due to invalid WKB).
So to solve the problem, I'm now adding extra 0 bytes at the array end.... and guess what... it works!
1: IWKs wks = (IWKs)(GeometryAdapter.Convert((IGeometry)value);
2: byte[] buffer = wks.ExportToWKB();
3: parameter.Value = buffer;
4: parameter.Size = buffer.Length;
5: if (parameter.Size == 32646) { 6: byte[] newBuffer = new byte[50000];
7: buffer.CopyTo(newBuffer, 0);
8: parameter.Value = newBuffer;
9: parameter.Size = 50000;
10: }
Labels: .net 2.0, c#, oracle