ORA-12704: character set mismatch with update statement

Saud Khan 26 Reputation points
2022-10-11T12:06:51.507+00:00

I'm using Oracle.ManagedDataAccess.Client to make queries to oracle database, but having an issue in update query.
I tried different workarounds like CAST with NVARCHAR2 and wrote DBInterceptor by following this POST.
But none of them are working. I also have an Insert Statement with the same parameters and it works perfectly. I'm struggling for the last 2 days, any help will be highly appreciatable.

Update Statement:

string query = @"update APP_DB_TABLE set ""Tracking_NM""=:reportName, ""Start_DT""=:startDate, ""End_DT""=:endDate, ""Tracking_Developer_NM""=:devName, ""Tracking_Description_TXT""=:description," +  
                @" ""RunBook_TXT""=:runbook, ""Parameter_TXT""=:params, ""Distribution_TXT""=:distributionList, ""OUTPUT_FILE_FILE_TXT""=:fileName," +  
                @"""CategoryId""=:catId, ""TrackingStatusId""=:trackingStatusId, ""TrackingTypeId""=:trackingTypeId where ""Db_Table_ID""=:id";  
  
            using (var conn = new OracleConnection(connection))  
            {  
                conn.Open();  
                var cmd = new OracleCommand(query, conn);  
                cmd.CommandType = System.Data.CommandType.Text;  
                cmd.Parameters.Add("id", data.Id);  
                cmd.Parameters.Add("reportName", data.ReportName);  
                cmd.Parameters.Add("startDate", data.StartDate);  
                cmd.Parameters.Add("endDate", data.EndDate);  
                cmd.Parameters.Add("devName", data.DeveloperName);  
                cmd.Parameters.Add("description", data.ReportDescription);  
                cmd.Parameters.Add("runbook", data.RunbookName);  
                cmd.Parameters.Add("params", data.ReportParameter);  
                cmd.Parameters.Add("distributionList", data.DistributionList);  
                cmd.Parameters.Add("fileName", data.OutputFileName);  
                cmd.Parameters.Add("catId", data.CategoryId);  
                cmd.Parameters.Add("trackingStatusId", data.TrackingStatusId);  
                cmd.Parameters.Add("trackingTypeId", data.TrackingTypeId);  
  
                try  
                {  
                    cmd.ExecuteNonQuery();  
                }  
                catch (Exception ex)  
                {  
  
                }  
            }  

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,917 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,507 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,008 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.