posted 11 years ago
So the problem is that you inserted 012345678912, but select gives you 12345678912?
When you store a number, the exact formatting (leading zeroes, trailing zeroes, superfluous plus sign and so on) are not stored. You'll have to format the number (either in the database using the TO_CHAR function, or in the client application) to convert it to the format you specify. The format can be constructed so that it provides the leading zeroes, eg.:(The FM modifier in Oracle format ensures there won't be a leading space).
There might still be a valid requirement to store the account number as a text, and not as a number (for example, if you envision different account number formats that would include non-numerical characters, such as dashes or slashes). Ultimately, the decision is on you, because no one else can know your exact situation. But even if you decide to store the account number as text, use a VARCHAR2 column, not CHAR. VARCHAR2 is much easier to expand if, all of sudden, you find that you need to store account numbers longer than 12 digits/characters. And if I was storing account number as text, I'd put constraints in place that would prevent invalid account numbers from ever been stored in the database.