Insert values with leading zeros How do I insert values with leading zeros in it? 

Example.

db2 "insert into db2inst1.asd_currency 
(currency_code, currency_name, currency_decimal_count, currency_code_desc) 
values ('007', 'afghani', 2, 'afa'), ('009','lek', 2, 'all')"


Its output would give me something like below

db2 "select * from fcm_currency"

CURRENCY_CODE CURRENCY_NAME        CURRENCY_DECIMAL_COUNT CURRENCY_CODE_DESC
------------- -------------------- ---------------------- ------------------
            4 afghani                                   2 afa               
            8 lek                                       2 all               
            7 afghani                                   2 afa               
            9 lek                                       2 all               

  4 record(s) selected.


However, I need to retain the leading zeros because it's a code and I'll be needing that for my application.

EXPECTED OUTPUT:

CURRENCY_CODE CURRENCY_NAME        CURRENCY_DECIMAL_COUNT CURRENCY_CODE_DESC
------------- -------------------- ---------------------- ------------------
          004 afghani                                   2 afa               
          008 lek                                       2 all               
          007 afghani                                   2 afa               
          009 lek                                       2 all               

  4 record(s) selected.
As is suggested in the comments, you should change the data type to, for example, char(3). If that is not possible, you can transform the value of the column like:

SELECT SUBSTR(DIGITS(CURRENCY_CODE),1,3) AS CURRENCY_CODE
FROM ...


or perhaps:

SELECT DIGITS(CAST(CURRENCY_CODE AS DECIMAL(3,0))) AS CURRENCY_CODE
FROM ...


which would be the same as:

SELECT DIGITS(DECIMAL(CURRENCY_CODE, 3,0)) AS CURRENCY_CODE
FROM ...


when you retrieve it