Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Handling Oracle types that JavaScript/Node can't handle #61

Open
richsad opened this Issue · 1 comment

2 participants

@richsad

Now that we can connect to Oracle we are experiencing a new suite of problems. The stored procs we must call have data types that JS/Node.js can't handle directly. We can't ask the DB team to change the procs because this would require a cascading set of changes to C++ and Java code that is not currently under development and expects the values from these stored procs to remain constant. So far we have encountered two specific problems:

Error: CreateColumnsFromResultSet: Unhandled oracle data type: 101

We believe this is being caused by a column in the results cursor that is of type binary_double. The second problem we are having is with some Number fields that are relying on 20 digits of precision. Because JavaScript supports only double precision floating point, the data is getting lost after the 16th digit. Unfortunately we need every digit since these numbers represent an account number. We did an experiment where we cast the binary_double to a float and cast the 20 digit Number to a string. This worked. But as I said we can't really change the stored procs.

It would seem this must be a problem other's have encountered. I see that you can specify the type of an OUTPARAM as in code like this:

connection.execute("call myProc(:1,:2)", ["nodejs", new oracle.OutParam(oracle.OCCISTRING)], function(err, results)

The challenge I have is that the result of the stored proc in my case is a results cursor with 58 columns of data for each result set. Of that data, most is of Oracle type "Number" with one field of type binary_double. I see in the source code where the CreateColumnsFromResultSet function is implemented and we could muck around with a copy of that function that takes an additional array of types to cast the columns too, but that seems ugly and we'd rather not modify your module if we can help it.

Is there a solution to this already in place that I am missing? Basically we want to cast data in the results from types unsupported in JavaScript/Node.js to types that are. Thanks in advance for any help. I am a bit of an Oracle Noob but have been programming professionally for more decades than I care to say! Oh how I wish this code were MySQL!!!

@ceridian

I'm having this problem as well, but with just running a select * from a table that it dosn't like. I'm just writing the data to file and not manipulating it at all, were would I go to just tell it to dump as a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.