?
Solved

BIT & BOOLEAN not available data types

Posted on 2008-10-20
3
Medium Priority
?
982 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
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Dave Ford earned 2000 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 46

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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension . This reminded me of questions that come up here at EE along the lines of, "How can I tell the type of file from its cont…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
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.
Suggested Courses

616 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