0

I have two computers :

Server :

  • Centos.

PC Developer:

  • windows xp

Both:

  • apache
  • php 5.3
  • connection with the same BD.

My table has a number column. When I print the number column in php, the output is :

Server :

12.244
12.890

Pc Developer

12,244
12,890

I want that the pc developer to print dot as decimal separator, but I don't know how to do it.

Both have the same configuration in php.ini ( datatimezone ) and in the pc developer , the default configuration for decimal separator is dot (.). I hope that you help me. Thanks.

Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78
JohnPortella
  • 1,791
  • 5
  • 21
  • 30

1 Answers1

0

Numeric characters(decimal and group separators) derived from nls_numeric_characters initialization parameter. Its default value, derived from nls_territory initialization parameter, and default value of the nls_territory initialization parameter is operating system depended - derived from NLS_LANG environment variable or registry entry on Linux/Unix or Windows operating systems respectively.

You can override default value of nls_numeric_characters initialization parameter, depending o your needs, instance-wide, session-wide, or statement-wide. Here is a simple example:

/* current value:  , (comma) as decimal separator and 
                   . (period) as group separator and 
 */
SQL> show parameter nls_numeric_characters

NAME                                 TYPE        VALUE 
------------------------------------ ----------- -------------
nls_numeric_characters               string      ,.  


SQL> with t1(col) as(
  2    select 1.23 from dual union all
  3    select 234.43 from dual
  4  )
  5  select col
  6    from t1;

       COL  
----------          
      1,23        
    234,43                 

Session-wide:

/* set . (period) as decimal separator and 
       , (comma) as group separator */  
SQL> alter session set nls_numeric_characters='.,';

Session altered.

SQL> with t1(col) as(
  2    select 1.23 from dual union all
  3    select 234.43 from dual
  4  )
  5  select col 
  6    from t1;

       COL                       
----------                    
      1.23                   
    234.43 

Statement-wide. In this situation we have to use to_char() function and provide number format model:

SQL> with t1(col) as(
  2    select 1.23 from dual union all
  3    select 234.43 from dual
  4  )
  5  select to_char(col, '990d00', q'[nls_numeric_characters='.,']') as res
  6       , col
  7    from t1;


RES            COL   
------- ---------- 
   1.23       1,23 
 234.43     234,43    
Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78