• 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

Oracle boolean data type

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currrently using :
boolean status = rsInfo.getBoolean("status");
to access a boolean (Yes / No) field in an Access DB.
If I need to port this to Oracle, will I need to make the field as Number(1) and use
int status = rsInfo.getInt("status");
and thus change all my Java code
Thanks,
Anoop
 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Generally in Oracle people use a Char(1) field and store 'T' and 'F' or 'Y' and 'N'. However with resultSet.getBoolean() that will throw an exception.
With java I just tried it out since I'm interested, if you use a number column, resultSet.getBoolean() works if you use 0 = false and null = false. Everything else is true.
Adam
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic