Version: 7.0.0

Boolean Type ​

Table 1 Boolean type

NameDescriptionStorage SpaceRange
BOOLEAN/BOOLStores Boolean data4 bytesTRUE, FALSE
  • Valid literal values for the "true" state include:

    TRUE, true, 'T', 't', 'TRUE', 'true', '1', and all non-zero integers.

  • Valid literal values for the "false" state include:

    FALSE, false, 'F', 'f', 'FALSE', 'false', '0', and 0.

Example:

-- Create a table.
SQL> CREATE TABLE bool_type_t1  
(
    BT_COL1 BOOLEAN,
    BT_COL2 TEXT
);

-- Insert data.
SQL> INSERT INTO bool_type_t1 VALUES (TRUE, 'sic est');

SQL> INSERT INTO bool_type_t1 VALUES (FALSE, 'non est');

-- View the data.
SQL> SELECT * FROM bool_type_t1;

BT_COL1 BT_COL2
------- ----------------------------------------------------------------
TRUE    sic est
FALSE   non est

2 rows fetched.

SQL> SELECT * FROM bool_type_t1 WHERE bt_col1 = 't';

BT_COL1 BT_COL2
------- ----------------------------------------------------------------
TRUE    sic est

1 rows fetched.

-- Delete the table.
SQL> DROP TABLE bool_type_t1;