Multiple choice technology databases

Which function can return a non-NULL value if passed a NULL argument?

  1. LENGTH

  2. CONCAT

  3. INSTR

  4. NULLIF

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

CONCAT can return non-NULL when passed NULL because it concatenates non-NULL values and ignores NULL arguments. For example, CONCAT('abc', NULL) returns 'abc'. LENGTH(NULL) returns NULL. INSTR with NULL returns NULL. NULLIF returns NULL if its arguments are equal, otherwise the first argument.

AI explanation

CONCAT can return a non-NULL result even when one argument is NULL, because Oracle SQL treats NULL as an empty string in string concatenation — so CONCAT('abc', NULL) returns 'abc', not NULL. LENGTH and INSTR propagate NULL (return NULL if the input is NULL), and NULLIF is specifically designed to produce NULL under certain conditions, not avoid it.