OCI7 - NUMBER datatype conversion

From: Alex <azp74_at_hotmail.com>
Date: 19 Sep 2002 08:01:26 -0700
Message-ID: <dca1064b.0209190701.5e697d8a_at_posting.google.com>


Hi there

I am wondering if there is any way to convert Oracle NUMBERs in to, say, reals/ints/strings using OCI7. I have just done this using OCINumberToReal in my 8i application but am struggling to find a way to do it in 7.

My application takes an Oracle datatype and then maps it to one of its own datatypes. In the 8i version I've mapped an SQLT_NUM to a double.  Then, when I detect an SQLT_NUM I bind it as an SQLT_VNU and, once I've done my execute and fetch, I pass the SQLT_VNU value to OCINumberToReal and it works fine.

I need to do a something similar with OCIv7.

This is because, if I create a table with an integer, a number, a number(11,2) and a float column when my application selects from it it thinks a number is an integer and only handles integer values correctly (rounds non integer values). My application cannot be arbitrary about the datatype it maps to - I have tried mapping directly to doubles but this just produces goobledegook.

I don't want to start executing PL/SQL blocks in my code so please don't suggest that!

Any other ideas?

TIA
Alex Received on Thu Sep 19 2002 - 17:01:26 CEST

Original text of this message