• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Leading zeroes in an Integer

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My data field allows leading zeroes with a maximum length of 3.
e.g. "001", "1", "123", "456" are all valid but "1234", "0001" are not valid.
One solution is to define the data field as CHAR(3) in the DB2 database.
Is it possible that the data field in the DB2 database be defined as INTEGER so that the leading zeroes are still preserved (i.e. “001” is different from “1”)?
If that is possible, how to manipulate the data field by Java?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

albert kaoIs it possible that the data field in the DB2 database be defined as INTEGER so that the leading zeroes are still preserved (i.e. “001” is different from “1”)?[/quote wrote:
No. You need to use char if you want to differentiate between the two.

 
ice is for people that are not already cool. Chill with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic