OCI8: Numbers fetched as strings
Date: Thu, 11 Sep 2008 18:58:02 +0200
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.)
- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
- Mi sitio sobre programación web: http://bits.demogracia.com
- Mi web de humor al baño María: http://www.demogracia.com --