Resolving the Oracle ODAC .NET error message “Attempted to divide by zero”

Issue

If you are executing a simple SQL query like

SELECT * FROM Articles

against an Oracle database from within a .NET application and you are getting an exception like

System.DivideByZeroException: Attempted to divide by zero.

In German:

System.DivideByZeroException: Es wurde versucht, durch 0 (null) zu teilen.

Cause

Probably a bug in the ODAC .NET drivers/layers. One user in the Oracle forums faced the same issue.

Resolution

In my case it was as simple as replacing the asterisk (“*”) with an explicit list of columns I wanted to query for.

E.g.

SELECT Name1, Price, Description FROM Articles

After that modification, I was successfully able to run the query and get results.

One thought on “Resolving the Oracle ODAC .NET error message “Attempted to divide by zero”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>