OCI8: Numbers fetched as strings

From: Álvaro G. Vicario <alvaroNOSPAMTHANKS_at_demogracia.com>
Date: Thu, 11 Sep 2008 18:58:02 +0200
Message-ID: <gabing$c2g$1@huron.algomas.org>


I'm playing with PHP and its oci8 extension and I'm facing a curious issue: numeric fields are returned as strings and, to make it worse, they're formatted using locale settings (well, sort of). For instance:

        1234.56 ---> "1234,56"

According to the documentation I've read, it isn't a bug: it's intentional. The "Underground PHP and Oracle Manual" describes the problem but it doesn't suggest any solution.

Am I supposed to write a custom parser to convert numeric strings into floats and pray that the DBA will never change the locale settings? Is it enough to run...

        alter session set nls_territory=america nls_language=american

... when I open the (persistent) connection? (I still get strings but at least they're easy to cast.)

--

Received on Thu Sep 11 2008 - 11:58:02 CDT

Original text of this message