Solved

BIT & BOOLEAN not available data types

Posted on 2008-10-20
3
869 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:
daveslash 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:daveslash
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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.

861 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