Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Number formatting question
Hi,
Sorry for asking such a dumb question.
I have an alphanumeric key, the last 2 digits of which should increment
every time a new record is saved. For this, I extract the last 2 digits
from the key (using substr) and increment it (add 1 to it). But when i
do a to_char() of this new number, it introduces a blank space.
For example: My key is in this format : TR05SEP200601. Here TR is item
code(say), 05SEP2006 is the system date and 01 is the serial number. If
i save another item of type TR on 05-SEP-2006, the number should be
TR05SEP200602.
To achieve this, i extract the last 2 digits of the key and add 1 to
it. But doing this converts it to a number and instead of displaying it
as '02' it displays it as '2'. If i try to use a to_char() function, it
includes an additional space which makes it like ' 02'.
Any help in this would be greatly appreciated.
Ashish Received on Wed Sep 06 2006 - 04:11:29 CDT
![]() |
![]() |