I am using Adempiere
which has database Oracle
I have window called Stock Code
from table called M_StockCode
A NUMBER cannot have leading zero, a STRING can.
If you want to store the codes with leading zero in the database table, then you must use VARCHAR2 and not NUMBER.
If you want to just display the number with leading zero, then use TO_CHAR to convert the number into string.
For example,
SQL> SELECT TO_CHAR(1, '00') FROM DUAL;
TO_
---
01
You could also use LPAD, but remember, the data type of the result would be a string and not a number.
For example,
SQL> SELECT LPAD(1, 2, '0') FROM DUAL;
LP
--
01
In Adempiere you manage the model via the Application Dictionary, it's the equivalent of the Data Dictionary used by relational databases.
Application Dictionary->Table & Column
. Synchronize Column
button to have Admepiere modify the database.If this code is some kind of classification it might be useful to create new Reference type in the Application Dictionary and then you could point your column to it; this would ensure consistency, offering the user a selection to choose from rather than entering values. A Reference can be a List type which is handy for short lists or Table driven which is useful when the classification is more volatile and needs to maintained by the users.