VALUE(x,y,...) is a special function that can be used to replace NULL values with a non-NULL value.
The arguments of the VALUE function must be comparable. The arguments are evaluated one after the other in the specified order.
|
Result of the VALUE(x,y) function |
One of the arguments is a non-NULL value |
The first non-NULL value that occurs |
Each argument is a special NULL value |
Special NULL value |
Each argument is a NULL value |
NULL value |
Example table: customer
The title does not occur in the output list. The word company is to be output for companies in the firstname column instead of a NULL value.
SELECT VALUE(firstname, 'company') firstname, name FROM customer
FIRSTNAME |
NAME |
Jenny |
Porter |
Company |
DATASOFT |
Martin |
Porter |
Sally |
Peters |
Peter |
Brown |
Michael |
Porter |
George |
Howe |
Frank |
Randolph |
Joseph |
Peters |
Susan |
Brown |
Anthony |
Jackson |
Thomas |
Adams |
Mark |
Griffith |
Company |
TOOLware |
Rose |
Brown |