Solved

BIT & BOOLEAN not available data types

Posted on 2008-10-20
3
803 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
Comment Utility

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
Comment Utility

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:Kdo
Comment Utility

'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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now