Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Preserve leading 0 in NUMBER columns ?
A copy of this was sent to Jan-Olav Eide <janolav_at_nr.no>
(if that email address didn't require changing)
On Tue, 22 Dec 1998 13:46:07 +0100, you wrote:
>I want to store, say, 03016536325 in a column,
>of type NUMBER (the leading 0 is significant).
>Can I do this or will I have to use VARCHAR2 ?
you have to use a varchar2. 01 = 1 = 001 = 0000001 when using a number, they are all the number 1 in a number field. In a varchar -- they will retain their leading zeroes.
If the number field is a fixed width field tho, you could always just select to_char( number_field, '0000000000000' ) as well -- if it is a varying length field, you have to use a string.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Dec 22 1998 - 07:56:49 CST