Error
ORA-01460: unimplemented or unreasonable conversion requested
Error Details
Getting the above error when trying to pass byte array of size greater than 32 K to Oracle BLOB column in ADO.NET code.
Solution
Remove the blob parameter from main insert or update statement and use below code to update Blob parameter later
OracleCommand cmd = new OracleCommand();
OracleConnection oraConn = new OracleConnection("Data Source=Emp;User ID=Emp;Password=Emp");
oraConn.Open();
OracleTransaction myTrans;
myTrans = oraConn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
cmd.Transaction = myTrans;
cmd.CommandText = "DECLARE dpBlob BLOB; BEGIN DBMS_LOB.CREATETEMPORARY(dpBlob, False, 0); :tmpBlob := dpBlob; END;";
cmd.Parameters.Add(new OracleParameter("tmpBlob", OracleType.Blob)).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
OracleLob tempLob = default(OracleLob);
tempLob = (OracleLob)cmd.Parameters[0].Value;
tempLob.BeginBatch(OracleLobOpenMode.ReadWrite);
tempLob.Write(doc, 0, doc.Length);
tempLob.EndBatch();
cmd.Parameters.Clear();
cmd.CommandText = "Update EmpDocument Set DOC = :blb WHERE EMPID= " + empID;
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add(new OracleParameter("blb", OracleType.Blob)).Value = tempLob;
cmd.ExecuteNonQuery();
myTrans.Commit();
Reach out to contactus@alltechnicalfaqs.com in case of further queries
Other Error Resolution :
Error : The type or namespace name 'ScriptManager' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)
Error : Unable to generate a temporary class (result=1). error CS2001: Source file
Error : dll file is being used by another process
Error : Unable to generate a temporary class (result=1). error CS2001: Source file
Error : dll file is being used by another process
No comments:
Post a Comment