Boolean data type
From SQL PL Guide for DB2
Boolean data type
The boolean data type is new in DB2 9.7. They can only be used for local variables, global variables, parameters, or return types in compound SQL (compiled) statements.
Global variables are supported by DB2 since Version 9.5. They're improving data sharing between different SQL statements which are running in the same session (or connection). Global variables are a new object in DB2 an will stored in the catalog view SYSCAT.VARIABLES. They have to create with the CREATE VARIABLE statement. There're multiple possibilities to set and change the values of the variables.
Example 1 (Create a boolean variable):
create variable myboolean BOOLEAN
Example 2 (Set a boolean variable):
set myboolean = true;
Example 3 (Function to check a value):
create function CHECK_VALUE (invar integer) returns boolean
begin
if invar > 0 then
return true;
else
return false;
end if;
end!
Link to the DB2 Information Center: DB2 9.7