NVL Function - Oracle to MariaDB Migration

In Oracle, the NVL function allows you to replace NULL with the specified expression: it returns the first operand if it is not NULL, and the second operand otherwise.

MariaDB also provides the NVL function (since 10.3.1) in both native and Oracle compatibility modes.

Oracle:

  -- Replace NULL
  SELECT NVL('John', 'N/A') FROM dual;
  /* John */
 
  -- Replace NULL
  SELECT NVL(NULL, 'N/A') FROM dual;
  /* N/A */

MariaDB - Oracle Compatibility:

  -- Replace NULL
  SELECT NVL('John', 'N/A');
  /* John */
 
  -- Replace NULL
  SELECT NVL(NULL, 'N/A');
  /* N/A */

For more information, see Oracle to MariaDB Migration - Oracle Compatibility Mode.