For some reason Oracle have no Boolean
Since there is no BOOLEAN datatype in Oracle, as far as tables are concerned.
CREATE TABLE BooleanTable (MyBool BOOLEAN);
ORA-00902: invalid datatype
But there is a BOOLEAN datatype in PL/SQL.
What should we do instead?
According to Tom at ThinkOracle you could create the table using char like this :
CREATE TABLE BoolTable (MyBool CHAR(1) CHECK (MyBool IN ( 'Y', 'N' )));
In our case (where I used to worked) we used Number instead. Same thing we did with the char but instead of “y/n” we use ‘0’ or ‘1’ where ‘0’ = false and ‘1’ = true
One response to “Oracle have no Boolean, how to fix this”
Oracle is pretty annoying with that. I’m surprise you are switching from oracle to mysql. Might make sense if you want to move to a cloud base solution like AWS.