This should be easy - but I'm having trouble working through it.
here's the situation. I have a field which MUST be 7 characters in length, is numeric in nature, and needs to have arithmetic functions applied. So, I guess I have multiple questions:
1) is there any way to "fix" the length of a numeric data type buy padding with "0"? 2) if not, how can I take the string value (example 0000100), convert to numeric so I can add 1 (I've succeeded in this step and the result comes back "101"), then convert back to "0000101" ??
Thanks in advance ! Rob
Joined: May 23, 2003
I don't think you can fix the length, but you can convert it to a number, do your operation, then convert it back. To convert it back goes something like this:
I don't have the API in from of me, so that may not be precisely right, but if you look at the java.text.DecimalFormat class API, you should be able to get the rest of it.