In other languages, a null value is found using the = null syntax. However in PLSQL to check if a value is null, you must use the "IS NULL" syntax.

To check for equality on a null value, you must use "IS NULL".

For example,

IF Lvalue IS NULL then

.

END IF;

If Lvalue contains a null value, the "IF" expression will evaluate to TRUE.

You can also use "IS NULL" in an SQL statement. For example:

select * from suppliers
where supplier_name IS NULL;

This will return all records from the suppliers table where the supplier_name contains a null value.

In other languages, a not null value is found using the != null syntax. However in PLSQL to check if a value is not null, you must use the "IS NOT NULL" syntax.

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.

You can also use "IS NOT NULL" in an SQL statement. For example:

select * from suppliers
where supplier_name IS NOT NULL;

This will return all records from the suppliers table where the supplier_name does not contain a null value.

Related Posts

  1. Oracle PL/SQL: Primary keys
  2. Oracle PL/SQL: Advanced Cursors
  3. Oracle PL/SQL: Sequences (Autonumber)
  4. Oracle PL/SQL: Loops and Conditional Statements
  5. Oracle PL/SQL: Cursors

Tags: , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>