HPlogo ALLBASE/SQL Reference Manual: HP 9000 Computer Systems > Chapter 7 Data Types

Null Values

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A null value is a special value that indicates the absence of a value. Any column in a table or parameter or local variable in a procedure, regardless of its data type, can contain null values unless you specify NOT NULL for the column when you create the table or the procedure. NULL is used as a placeholder for a value that is missing or unknown. These properties of null values affect operations on rows or parameters or local variables containing the following values:

  • Null values always sort highest in a sequence of values.

  • Two null values are not equal to each other except in a GROUP BY or SELECT DISTINCT operation, or in a unique index.

  • An expression containing a null value evaluates to null; for example, five minus null evaluates to null.

Because of these properties, ALLBASE/SQL ignores columns or rows or parameters or local variables containing null values in these situations:

  • Evaluating comparisons

  • Joining tables, if the join is on a column containing null values

  • Executing aggregate functions

  • Evaluating if/while conditions or assignment expressions

In several SQL predicates, described in Chapter 9 “Search Conditions” you can explicitly test for null values. In an application program, you can use indicator variables to handle input and output null values.

Feedback to webmaster