Home » SQL & PL/SQL » SQL & PL/SQL » table with a boolean column
table with a boolean column [message #258660] Mon, 13 August 2007 05:07 Go to next message
orafacjublu
Messages: 95
Registered: May 2006
Location: KOLKATA
Member
Can we create a table with a column of boolean datatype , if yes what is that create table syntax ? How to we insert data in this column? PLS help..........
Re: table with a boolean column [message #258661 is a reply to message #258660] Mon, 13 August 2007 05:09 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
BOOLEAN isn't among available Oracle column datatypes.

You'll have to make it, for example, a NUMBER(1) and insert 0 for FALSE and 1 for TRUE, or VARCHAR2(1) with T for TRUE and F for FALSE or ...
Re: table with a boolean column [message #258663 is a reply to message #258660] Mon, 13 August 2007 05:14 Go to previous messageGo to next message
ShivrajGutte
Messages: 21
Registered: April 2007
Location: PUNE
Junior Member
Boolean is pl/sql datatype ,It is not supported in Database So we can not create column with boolean datatype.

Regards
Shivraj
Re: table with a boolean column [message #258667 is a reply to message #258660] Mon, 13 August 2007 05:23 Go to previous messageGo to next message
Arju
Messages: 1554
Registered: June 2007
Location: Dhaka,Bangladesh. Mobile:...
Senior Member

You can accomplish by using check constraint.
SQL> create table check_boolean(
  2  a char(1) check (a in ('T','F')));

Table created.

Re: table with a boolean column [message #258875 is a reply to message #258667] Mon, 13 August 2007 12:34 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Adding a check constraint doesn't make a single character a boolean..
Previous Topic: How to see all the tables create by me?
Next Topic: to recompile java objects
Goto Forum:
  


Current Time: Mon Dec 02 07:40:37 CST 2024