Solved

BIT & BOOLEAN not available data types

Posted on 2008-10-20
3
923 Views
Last Modified: 2013-12-06
Apparently AS400 iSeries SQL R5V3 does not support data types BIT nor BOOLEAN ...

How do y'all declare and use a YES/NO, TRUE/FALSE value in a Stored Proc?

Example please?
0
Comment
Question by:volking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Dave Ford earned 500 total points
ID: 22759980

There are a couple different ways.

You can define a CHAR(1) column with a check-constraint that limits the values to 'Y' or 'N'.

Alternately (and, in my experience, more commonly used) is to define it as a SMALLINT column with a check-constraint that limits it to 0 or 1.

HTH,
DaveSlash
0
 
LVL 18

Expert Comment

by:Dave Ford
ID: 22760017

Ironically, the DB2 for i5/OS reference manual lists "BOOLEAN" as a reserved word, so they must have some kind of plans to implement it.

-- DaveSlash
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 22760162

'Boolean' has been a reserved word in DB2 for a long, long time.

And in UDB/LUW version 9.5 it has the exact same meaning as it did in version 7.  :)


Back on topic, if the field is primarily going to be displayed, any Char/Varchar value(s) will work.  If you're going to compare, search, index, join, etc. on the field, make it an integer.  Almost every operation in DB2 is faster on a native integer than any other data type.

Good Luck
Kent
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question