Posts

Showing posts with the label Oracle

"Arithmetic operation resulted in an overflow" Error When Retrieving Data From Oracle In .NET

I ran into this fun little exception today when calling a stored procedure in Oracle from some .NET code. The error message was "Arithmetic operation resulted in an overflow", and from what I was able to Google, it seemed like it was caused by a difference in precision between numeric data types in .NET and Oracle, or  by the need to compile the code in 32-bit mode. But in my case, neither was the cause. When one of our DBAs suggested I try the same code using the simple "SELECT 1 FROM DUAL" query, and the exception still  occurred, I began to look for other reasons. Fortunately, it was an easy fix. The cause of the problem was actually a setting on the DevArt OracleCommand object being used in the .NET code. Here is the offending line of code: command.FetchSize =  int .MaxValue; Removing this line of code corrected the problem.

Resolving the "Unable to load the specified metadata resource" Error When Using a Devart Entity Model

I recently made use of a Devart Entity Model to allow me to use LINQ with an Oracle database and to get around an issue when using views with Entity Framework 4.1. Everything worked well...until the code was deployed. When running on my local PC (either through Visual Studio or from another site under my local IIS) the code worked without a problem. But when built using our build machine, I would receive the "Unable to load the specified metadata resource" exception when trying to call a service method that made use of the entity model. When I used IL DASM (ildasm.exe) to examine the manifests of the assembly built locally versus the one built on the build machine, I found that, indeed, the resources for the Devart Entity Model were not present in the assembly manifest of the assembly that was built on the build machine. The solution -- and it's not a good solution -- was to install the Devart developer tools on the build machine. Again, this is not a good solution -- o...

Troubleshooting the "ORA-01036: illegal variable name/number" Error When Calling an Oracle Stored Procedure from .NET

Yesterday I had written some code in C# to call a stored procedure in an Oracle database, and when I began testing this code today, I was surprised to get the following error whenever the code would attempt to execute the OracleCommand: ORA-01036: illegal variable name/number I was scratching my head. Why wasn't this working? I've done this before! From previous experience, I knew that the names of the procedure parameters must match exactly when you add them to the OracleCommand object . In other words, if your stored procedure is expecting two parameters, named email and phonenumber , your code should look something like this: cmd.Parameters.Add("email", OracleType.VarChar); cmd.Parameters.Add("phonenumber", OracleType.VarChar); cmd.Parameters["email"].Value = psEmail; cmd.Parameters["phonenumber"].Value = psPhone; I checked the parameter names and I was already using the correct ones. What else was I missing? Then it dawned on me...