What Is the Data Type for Boolean in Oracle?


Larry Thompson

When working with Oracle databases, it is important to understand the different data types that are available. One commonly used data type is the Boolean data type. In Oracle, the Boolean data type is used to store logical values, such as true or false.

Boolean Data Type in Oracle

The Boolean data type was introduced in Oracle version 12c. It is represented by the keywords TRUE and FALSE. The Boolean data type can be used to store only one of these two values.

In Oracle, the Boolean data type can be used in various situations. For example, you can use it to represent whether a condition is true or false, or to indicate the status of a particular operation. It provides a more efficient and concise way of storing and retrieving logical values compared to other data types.

Defining a Column with Boolean Data Type

To define a column with the Boolean data type in an Oracle table, you need to use the BOOLEAN keyword. Here’s an example:

CREATE TABLE my_table (
    id NUMBER,
    active BOOLEAN

In this example, we have created a table called my_table, which has two columns: id, which has a NUMBER data type, and active, which has a BOOLEAN data type.

Using Boolean Data Type in Queries

To query for rows based on the value of a column with the Boolean data type, you can use comparison operators like =, <>, and so on. Here’s an example:

FROM my_table 
WHERE active = TRUE;

This query will return all rows from the my_table where the active column has the value TRUE. Similarly, you can use other comparison operators to filter based on different conditions.

Boolean Functions and Expressions

In addition to simple comparisons, Oracle also provides several Boolean functions and expressions that can be used with the Boolean data type. Some common examples include:

  • NOT: The NOT operator is used to negate a Boolean value. For example, NOT active will return true for rows where the active column has a value of false.
  • AND: The AND operator is used to combine multiple Boolean conditions.

    For example, (active = TRUE) AND (id > 10) will return rows where both conditions are true.

  • OR: The OR operator is used to combine multiple Boolean conditions and returns true if any of the conditions are true. For example, (active = TRUE) OR (id > 10) will return rows where either condition is true.


The Boolean data type in Oracle provides a convenient way to store and manipulate logical values. It allows you to represent true or false conditions efficiently and effectively. By understanding how to define columns with the Boolean data type and use it in queries and expressions, you can make your Oracle database interactions more intuitive and powerful.

You have now learned about the Boolean data type in Oracle! Use this knowledge wisely in your future database projects!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy