G-2410: Try to use boolean data type for values with dual meaning.
Minor
Maintainability
Reason
The use of TRUE and FALSE clarifies that this is a boolean value and makes the code easier to read.
Example (bad)
DECLARE
co_newFile CONSTANT PLS_INTEGER := 1000;
co_oldFile CONSTANT PLS_INTEGER := 500;
l_bigger PLS_INTEGER;
BEGIN
IF co_newFile < co_oldFile THEN
l_bigger := constants_up.co_numeric_true;
ELSE
l_bigger := constants_up.co_numeric_false;
END IF;
END;
/
Example (better)
DECLARE
co_newFile CONSTANT PLS_INTEGER := 1000;
co_oldFile CONSTANT PLS_INTEGER := 500;
l_bigger BOOLEAN;
BEGIN
IF co_newFile < co_oldFile THEN
l_bigger := TRUE;
ELSE
l_bigger := FALSE;
END IF;
END;
/
Example (good)
DECLARE
co_newFile CONSTANT PLS_INTEGER := 1000;
co_oldFile CONSTANT PLS_INTEGER := 500;
l_bigger BOOLEAN;
BEGIN
l_bigger := NVL(co_newFile < co_oldFile,FALSE);
END;
/