Results 1 to 4 of 4

Thread: number format

  1. #1
    Join Date
    Jan 2005
    Posts
    362

    Unanswered: number format

    I want to ask a simple question.
    How can we give a format to a number field of a query even we do not know the number of digits of this number?
    Dimis

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Where did you get this number? Is it from a table? If so, DESCRIBE the table and you'll know it. Is it a variable? If so, you'll know how it was defined.

    If it is just an ordinary SELECT 1234123412412 FROM dual and you'd like to format it, I'm afraid you can't.

    Actually, if it is possible, I don't know how to do it.

  3. #3
    Join Date
    Jan 2005
    Posts
    362

    Format

    It is a sum of numbers of a table.
    I gave something like this
    SELECT to_char(255210.73, '999G999G999G999D99') FROM DUAL
    I do not thing it will be greater than '999G999G999G999D99'.
    Dimis

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I see ... if you don't want to bother with the TO_CHAR function, you might include the following SET command into the LOGIN.SQL file; doing so, all numbers will be formatted to the format you specify.
    Code:
    SQL> set numformat 999G999G999D99
    SQL> select 123 from dual;
    
                123
    ---------------
             123.00
    
    SQL>

Posting Permissions

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