How do you keep leading zeros in a number(6) field? I need the leading zeros to be stored. I have the folwoing code :
SET SSN = LPAD(emp_no,3,0)||9999;
The script runs fine except the leading zeros are truncated because of the datatype. Is there a way to keep the leading zeros?
04-24-2002, 03:33 PM
SQL> select to_char(123, '099999') from dual;
SQL> col a format 0999999;
SQL> select 123 a from dual;
04-25-2002, 06:13 AM
I don't think there is any way of storing leading zeros in number datatype in the database. While retrieving it however you can do so by using the format Shestakov specified. I would prefer keeping the field as a char/varchar2 type!
04-25-2002, 10:23 AM
Why need keep leading zeros, usually need only show this zeros in screen forms or
print its in document.