Purpose
TIMESTAMP_NVL() checks whether a timestamp expression is NULL. If the first expression is not NULL, the function returns the first expression. Otherwise, it returns the second expression.
Syntax
TIMESTAMP_NVL(expr1, expr2)
Parameters
Parameter |
Description |
|---|---|
| expr1 | The first timestamp expression. |
| expr2 | The timestamp expression to return if expr1 is NULL. |
Return type
The return type is a timestamp data type. If both expressions are NULL, the function returns NULL.
Examples
In the following example, the first expression is NULL, so the function returns the second timestamp expression:
obclient> SELECT TIMESTAMP_NVL(
CAST(NULL AS TIMESTAMP),
TIMESTAMP '2026-10-09 10:00:00'
) AS result
FROM DUAL;
+------------------------------+
| RESULT |
+------------------------------+
| 09-OCT-26 10.00.00.000000 AM |
+------------------------------+
1 row in set