DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Error in To_char

  1. #1
    Join Date
    Jan 2009
    Posts
    10

    Error in To_char

    Hi All,


    Iam executing the below statement with value as two digit number.



    Select to_number(to_char('10','99999999,99')) from dual ;


    Iam getting the output as 10

    when run for 3 digit number iam getting Invalid number.

    Select to_number(to_char('125','99999999,99')) from dual ;

    Like to kknow what makes this happen or how to rectify it.


    Thanks!

    Tarus

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Wink Did you set group and decimal characters?

    Did you set NLS_NUMERIC_CHARACTERS = ",."?
    Code:
    SQL> alter session set NLS_NUMERIC_CHARACTERS = ",.";
    
    Session altered.
    
    SQL> select to_char(10,'999G999D99') from dual;
    
    TO_CHAR(10
    ----------
         10,00
    
    1 row selected.
    
    SQL> select to_char(125,'999G999D99') from dual;
    
    TO_CHAR(125
    -----------
         125,00
    
    1 row selected.
    
    SQL> select to_char(12345,'999G999D99') from dual;
    
    TO_CHAR(123
    -----------
      12.345,00
    
    1 row selected.
    
    SQL>
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width