ISNOTNULL()

Overview

Returns a boolean that indicates if the argument is not NULL.

USAGE

ISNOTNULL(value)

Argument Name

Description

value

The value to be tested

DETAILS

ISNOTNULL() returns a boolean indicating if the expr does not evaluate to NULL.

The return value is 0 if the function argument evaluates to NULL, otherwise it returns 1.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

With Literal Values

In the following examples, ISNOTNULL() is called with literal values:

SELECT ISNOTNULL(0+1);
+----------------+
| ISNOTNULL(0+1) |
+----------------+
|              1 |
+----------------+
SELECT ISNOTNULL(1/0);
+----------------+
| ISNOTNULL(1/0) |
+----------------+
|              0 |
+----------------+

Example Schema and Data

The remaining examples are based on the example table contacts:

CREATE TABLE contacts (
  first_name VARCHAR(25),
  last_name VARCHAR(25),
  email VARCHAR(25),
  new_contact boolean
);
INSERT INTO contacts VALUES
  ("John","Smith","john.smith@example.com",false),
  (NULL,"Smith","jane.smith@example.com",false),
  ("Sally","Smith",NULL,NULL),
  (NULL,NULL,NULL,NULL);

Per-row Evaluation

SELECT ISNOTNULL(first_name) AS first_name,
       ISNOTNULL(last_name) AS last_name,
       ISNOTNULL(email) AS email,
       ISNOTNULL(new_contact) AS new_contact
 FROM contacts;
+------------+-----------+-------+-------------+
| first_name | last_name | email | new_contact |
+------------+-----------+-------+-------------+
|          1 |         1 |     1 |           1 |
|          0 |         1 |     1 |           1 |
|          1 |         1 |     0 |           0 |
|          0 |         0 |     0 |           0 |
+------------+-----------+-------+-------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES