BOOLEAN

The BOOLEAN data type stores a logical value, TRUE or FALSE.

Syntax

BOOLEAN

Usage

BOOLEAN values can be NULL, TRUE (integer 1) or FALSE (integer 0).

The default value of a BOOLEAN variable is FALSE.

Boolean variables are typically used to store the result of a boolean expression:
FUNCTION checkOrderStatus( cid )
  DEFINE oid INT, b BOOLEAN
  LET b = ( isValid(oid) AND isStored(oid) )
  IF NOT b THEN
    ERROR "The order is not ready."
  END IF
END FUNCTION

Data type conversion can be controlled by catching the runtime exceptions. For more details, see Handling type conversion errors.

SQL database vendor specific implementation of the boolean SQL type may not correspond exactly to the Genero BOOLEAN type. For example, IBM® Informix® SQL boolean type accepts the 't' and 'f' values, while the BOOLEAN Genero type expects 0/FALSE and 1/TRUE integer values only. You can however use a BOOLEAN variable in SQL statements: IBM Informix will handle the conversion, and for other databases, the db drivers handle the conversion. Note also that the TRUE/FALSE constants are Genero language constants: The SQL syntax of the database may not support these keywords, for example in an statement such as INSERT INTO mytable (key,bcol) VALUES (455,TRUE). For more details, see SQL portability.