VALUE(x,y,...) is a special function that can be used to replace NULL values with a non-NULL value.
The arguments (expressions) of the VALUE function must be comparable. The expressions 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 |
SELECT VALUE(firstname, 'Company') firstname, name
FROM 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.
FIRSTNAME |
NAME |
Jenny |
Porter |
Peter |
Brown |
Company |
Datasoft |
Rose |
Brian |
Mary |
Griffith |
Martin |
Randolph |
Sally |
Smith |
Mike |
Jackson |
Rita |
Doe |
George |
Howe |
Frank |
Miller |
Susan |
Baker |
Joseph |
Peters |
Company |
TOOLware |
Antony |
Jenkins |