This Oracle tutorial explains how to use the Oracle IS NOT NULL condition with syntax and examples.
The Oracle IS NOT NULL condition is used to test for a NOT NULL value. You can use the Oracle IS NOT NULL condition in either a SQL statement or in a block of PLSQL code.
The syntax for the IS NOT NULL condition in Oracle/PLSQL is:
expression IS NOT NULL
The value to test whether it is a not null value.
Here is an example of how to use the Oracle IS NOT NULL condition in a SELECT statement:
SELECT *
FROM customers
WHERE customer_name IS NOT NULL;
This Oracle IS NOT NULL example will return all records from the customers table where the customer_name does not contain a null value.
Here is an example of how to use the Oracle IS NOT NULL condition in an INSERT statement:
INSERT INTO suppliers
(supplier_id, supplier_name)
SELECT account_no, name
FROM customers
WHERE account_no IS NOT NULL;
This Oracle IS NOT NULL example will insert records into the suppliers table where the account_no does not contain a null value in the customers table.
Here is an example of how to use the Oracle IS NOT NULL condition in an UPDATE statement:
UPDATE customers
SET status = 'Active'
WHERE customer_name IS NOT NULL;
This Oracle IS NOT NULL example will update records in the customers table where the customer_name does not contain a null value.
Here is an example of how to use the Oracle IS NOT NULL condition in a DELETE statement:
DELETE FROM customers
WHERE status IS NOT NULL;
This Oracle IS NOT NULL example will delete all records from the customers table where the status does not contain a null value.
You can use the Oracle IS NOT NULL condition in PLSQL to check if a value is not null.
For example:
IF Lvalue IS NOT NULL then
...
END IF;
If Lvalue does not contain a null value, the "IF" expression will evaluate to TRUE.
This Oracle tutorial explains how to test for a value that is null.