tags:

views:

33

answers:

2

Hi I wanna create a Boolean field in my oracle table but I seen there is no boolean or byte data type so,which one of the oracle data type I must choose for a boolean value?

answer: I find how Oracle developer do this by wisard:

CREATE TABLE TABLE17
(
  COLUMN1 CHAR(1 BYTE) NOT NULL,
  COLUMN2 VARCHAR2(4000)
)
;
+3  A: 

if you are looking for "y" or "n" you can use CHAR(1)

hGx
I prefer this because you can often get away with showing it as is in reports.
Jeffrey Kemp
You can also use a check constraint to enforce that it only contains one of the valid values. And if you name the field something like VALID_YN it is obvious that it should be YN rather than, say, T(rue)/F(alse).
Gary
+1  A: 

You can use char(1) or number(1)

If you use number(1), set 0-False and 1-True as many programming languages 1 & 0 for Boolean

Bharat