BOOLEAN
The BOOLEAN
data type stores a logical value,
TRUE or FALSE.
Syntax
BOOLEAN
Usage
Boolean data types have two possible values: TRUE
(integer 1) and
FALSE
(integer 0).
DEFINE result BOOLEAN
LET result = ( length("abcdef") > 0 )
Data type conversion can be controlled by catching the runtime exceptions. For more details, see Handling type conversion errors.
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
Note that the 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.