chickadee » sql-null » sql-coalesce

(sql-coalesce test-1 ...)syntax

The TEST expressions are evaluated from left to right, and the value of the first expression that is not SQL NULL is returned, and any remaining TESTs are not evaluated. If no such value is found, SQL NULL is returned, similar to the SQL `COALESCE' function.

(sql-coalesce 1) => 1
(sql-coalesce (sql-null)) => SQL NULL
(sql-coalesce (sql-null) 2) => 2
(sql-coalesce #f (sql-null) 1) => #f

This is like Scheme's or macro, instead of treating #f as the only false value, it treats SQL NULL as false and everything else as true.