How do I return leading zeros?
I'm trying to duplicate the functionality of this case statement in 10.2.0.5 on Solaris SPARC 64:
case when substr(to_char(COLUMN),1,1) = '.'
then '0'||to_char(COLUMN)
when substr(to_char(COLUMN),1,2) = '-.'
then replace(to_char(COLUMN),'-.','-0.')
else to_char(COLUMN) end COLUMN
For the particular problem I'm trying to solve, the COLUMN column may be in the following formats:
NUMBER(17,7)
NUMBER(14,4)
NUMBER
The actual data may have a wide variety of digits to the left and right of the decimal point.
I"m aware of the fact that TO_CHAR provides a format argument but I have not been able to create a format pattern that matches this exact functionality.