Firebird DocsetFirebird Database Docs → Firebird Null Guide
Firebird home Firebird home Home: Firebird DocsetUp: Firebird Database DocsNext: What is NULL?

Firebird Null Guide

NULL behaviour and pitfalls in Firebird SQL

Paul Vinkenoog

15 April 2005 - Document version 0.2


Table of Contents

Introduction
What is NULL?
NULL in expressions
NULL handling in UDFs
NULL in if statements
Testing if something is NULL
Setting a field or variable to NULL
Dealing with NULLs
Summary
A. Document history
B. License notice

Introduction

Time and again, support questions pop up on the Firebird mailing lists related to “strange things” happening with NULLs in Firebird SQL. The concept seems difficult to grasp - perhaps partly because of the name, which suggests a “nothing” that won't do any harm if you add it to a number or stick it to the back of a string. In reality, performing such operations will render the entire expression NULL.

This article explores the behaviour of NULL in Firebird SQL, points out common pitfalls and shows you how to safely deal with expressions that contain NULL or may resolve to NULL.

If all you want is a quick reference to refresh your memory, hop straight to the summary (which is really brief indeed).

Note

A few sentences and examples in this guide were taken from the Firebird Quick Start Guide, first published by IBPhoenix, now part of the Firebird Project.

Home: Firebird DocsetUp: Firebird Database DocsNext: What is NULL?
Firebird DocsetFirebird Database Docs → Firebird Null Guide