Re: OCI8: Numbers fetched as strings

From: Laurenz Albe <>
Date: 12 Sep 2008 07:13:25 GMT
Message-ID: <>

"Álvaro G. Vicario" <> wrote:
> 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.)

I would change the session parameter NLS_NUMERIC_CHARACTERS which controls the decimal comma character.

Laurenz Albe Received on Fri Sep 12 2008 - 02:13:25 CDT

Original text of this message