Oracle does not support a bit
datatype or any other type for true/false scenarios. Does one use the char(1)
field instead by using a specific letter to denote yes / true regardless of culture specific issues?
Instead of char
should it be Number(1,0)
for this instead - 0 being considered false / no, anything else being interpreted as true / yes?
Is this viable?
Why does Oracle not support a simple boolean type?
The BIT datatype is usually represented by NUMBER(1) in Oracle systems as it simplifies comparison operations, but you could also use CHAR(1). The TIMESTAMP datatype can be represented using the ORA_ROWSCN pseudo column in Oracle.
However, Oracle internally converts such datatypes to Oracle datatypes. The IBM products SQL/DS and DB2 datatypes TIME, TIMESTAMP, GRAPHIC, VARGRAPHIC, and LONG VARGRAPHIC have no corresponding Oracle datatype, and cannot be used. The TIME and TIMESTAMP datatypes are subcomponents of the Oracle datatype DATE.
Use a CHAR(1)
, and a constraint to allow only 1
and 0
.
...
col CHAR(1), CONSTRAINT cons_atable_col1 CHECK (col1 IN ('1','0'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With