?
Solved

BIT & BOOLEAN not available data types

Posted on 2008-10-20
3
Medium Priority
?
943 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 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
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.

801 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