You can use a new system-defined Boolean data type for use within SQL Procedural Language (SQL PL) applications that provides support for declaring and referencing the system-defined logical values: TRUE, FALSE, or NULL within compound SQL (compiled) statements.
The Boolean data type is like any other built-in type, such that it can also be referenced in expressions and assigned the resulting value of a logical expression.
CREATE VARIABLE gb BOOLEAN;
SET gb = TRUE;
The following is an example of a simple SQL function that
accepts a Boolean parameter value and also returns a Boolean value:CREATE FUNCTION fb1(p1 BOOLEAN, p2 INT) RETURNS BOOLEAN
BEGIN
IF p1 = TRUE AND p2=1 THEN
RETURN p1;
ELSE
RETURN FALSE;
END IF;
END
The following is an example of how to set the variable
with the output function fb1:SET gb = fb1(TRUE,1);