Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create boolean attribute in Oracle? [duplicate]

I have to create a table in Oracle and one column I have to make it of Boolean type. Can you please tell me how can I do that? I have searched on the internet but I couldn't find a clear answer.

like image 355
Cristian Holdunu Avatar asked Dec 21 '22 10:12

Cristian Holdunu


1 Answers

There is no BOOLEAN datatype in SQL. But we can represent it like this:

CREATE TABLE tt
  (test NUMBER(1) NOT NULL CHECK  (test in (0,1)))
like image 133
Raphaël Althaus Avatar answered Dec 30 '22 16:12

Raphaël Althaus