Skip to main content

Posts

Showing posts with the label null

PL/SQL 101: Nulls in PL/SQL

The Oracle Database supports a concept of a null value,  which means, essentially, that it has no value . The idea of having nulls in a relational database is controversial , but Oracle Database supports them and you need to know how they can impact your work in PL/SQL. First, and most important, remember that: Null is never equal to anything else, including null. And certainly 0. Null is never not equal to anything else, including null. DECLARE var INTEGER; BEGIN IF var = NULL THEN ... IF NULL = NULL THEN ... IF var <> NULL THEN ... IF NULL != NULL THEN ... END; you can rest assured that the code represented by "..." will never  be executed. Note: NULL in the above code is a literal value with a non-value of null. The same holds true for where clause predicates in a SQL statement. The following queries will never return any rows, regardless of the contents of the employees table. SELECT * FROM employees WHERE employee_id = NULL / SEL...