• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Get a char out of a db

Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a value stored in an oracle db of type
I have tried everything in the world to read it into a char variable but I cannot get it to work.
I have tried...
How do I do it?
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just like Larry Jones replied before, use String.

This handles the String and null values as well. However it does not handle empty String's. I know DB2 will return a String with blanks instead of an empty String for CHAR colums, if they are not null. However, I don't know how your DB handles that. You may want to try it first and add another if statement in case it's necessary.
Beware of other getXxx() methods to retrieve character data. For instance, getBytes() will get the byte values of a CHAR column into an array of bytes, but it WILL NOT do any character conversion for you. You most likely will end up with wrong (non-converted) characters...
[ November 07, 2002: Message edited by: Paulo Salgado ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic