BC remote Oracle DBA - Call (800) 766-1884
Free Oracle Tips

Oracle Consulting Oracle Training Development

Remote DBA

 

Remote DBA Plans
Remote DBA Service

 
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Internals Magazine
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 
 

EnterpriseDB: Miscellaneous Types

Oracle Tips by Burleson Consulting
 

BOOLEAN

A Boolean value is a
TRUE or FALSE indicator.  The only valid values for BOOLEAN are TRUE, FALSE, and NULL.  NULL does not mean either TRUE or FALSE.  It just means that no value has been set.  You may choose to consider a NULL to be false.

Oracle does not support a Boolean data type (in SQL, it does in PL/SQL).  In Oracle, you would generally store Booleans as either NUMBERs or VARCHAR2s.  For example, you may say that in a given column, a 0 means TRUE and any other number means FALSE or vice versa.  Or maybe 1 means TRUE and any other number means FALSE.  Or maybe 0 means TRUE and 1 means FALSE and any other number is invalid.

If you used a VARCHAR2, you could store the letters "TRUE" or "FALSE".  Of course, you could also store "YES" and "NO".  Or "Y" or "N".  How about "T" or "F"?

Do you see where I'm going with this?  A BOOLEAN is a very basic data type.  When each developer/designer is left to decide how to implement a basic type, hilarity can ensue.

The BOOLEAN data type is defined in the SQL standard (although as an optional type).  EnterpriseDB supports the BOOLEAN standard as defined in the SQL standard.  You may reference an EnterpriseDB BOOLEAN as several values but you should try to stick with the TRUE or FALSE syntax.

CREATE TABLE boolean_table (
  bool_true BOOLEAN,
  bool_false BOOLEAN
); 

INSERT INTO boolean_table (bool_true, bool_false)
  VALUES (TRUE, FALSE); 

SELECT * FROM boolean_table; 

edb=# CREATE TABLE boolean_table (
edb(#   bool_true BOOLEAN,
edb(#   bool_false BOOLEAN
edb(# );
CREATE TABLE

edb=#
edb=# INSERT INTO boolean_table (bool_true, bool_false)
edb-#   VALUES (TRUE, FALSE);
INSERT 0 1
edb=#
edb=# SELECT * FROM boolean_table;

 bool_true | bool_false
-----------+------------
 t         | f

(1 row) 

edb=#



This is an excerpt from the book "EnterpriseDB: The Definitive Reference" by Rampant TechPress.


Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.

 

 

Remote DBA Service
 

Oracle Tuning Book

Free Oracle dictionary reference poster

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

North Carolina Oracle Users Group

 

 Arabian horse breeder

Seeing eye horses

 

 

Burleson is the American Team

American Flag

 

 

BC Remote Oracle Support
P.O. Box 511 • Kittrell, NC, 27544

Remote DBA

Remote DBA Services

 

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.



Hit Counter