<< Click to Display Table of Contents >> Navigation: 5. Detailed description of the Actions > 5.5. Standard > 5.5.6. Calculator (High-Speed action) > 5.5.6.2. Handling NULL Values |
Most programming languages (such as Java, C/C++, Delphi, etc.) are using a standard 2-way boolean logic:
Note: “0” means FALSE; “1” means TRUE.
To handle null values, Anatella uses the same three-way logic as the standard SQL:
Note: “0” means FALSE; “1” means TRUE; “NULL” is the null value.
This means that the expression (a==_null) will always return null as result. As a consequence, the expression (a==_null?”foo”:”bar”) will always return “bar”. The right way to test if a variable is null is the following: (isNull(a):”foo”:”bar”) or even better (because it’s faster): (nvl2(a,”foo”,”bar”)).
The word “_null” inside an expression cannot be used inside a boolean operation but it’s perfectly valid to use it as “return” value. For example: (a<b:_null:1) or (a<b:_nullS:"1") are perfectly valid expressions (use "_nullS" when the return value is of the string/unknown type and use “_null” when the return value is of the Float or Key type).