Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007

    Unanswered: how to pad numbers with zero to a specified width

    Hi All,
    I am running on oracle 10g. I have values with number datatype that I wish to pad with zeros (0) from the LEFT to a specified width. the values have varying width and some of the numbers are negative numbers.
    When i try to pad with LPAD function having converted the data to character datatype, it pads with zeros well but the negative numbers have their padding with 0s coming first before the negative sign making it look like an hyphen. e.g 0000000-943 instead of -00000000943. My desired result is -00000943 and not 00000-943. Please can someone help with this?

  2. #2
    Join Date
    Jun 2004
    Liverpool, NY USA
    Just use the correct format mask.

    >select to_char(-193.34,'00000000.00') from dual;
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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