%COALESCE meta-SQL element

Syntax

%COALESCE(expr1, expr2, ...)

Description

Use the %COALESCE function to return the first non-null argument provided to the function.

Note:

This meta-SQL function is not implemented for COBOL.

Parameters

Parameter Description

expr1. . .exprn

Specify the expressions to check.

Note: You cannot specify bind parameters using these expressions.

Note:

%COALESCE has been desupported but remains for backward compatibility only. Use your database's native COALESCE function instead.

Example

The following example uses the PRODUCT_INFO table to organize a clearance sale of products. It gives a 10 percent discount to all products with a list price. If there is no list price, the sale price is the minimum price. If there is no minimum price, the sale price is 10.

SELECT product_id, list_price, min_price, %COALESCE(0.9*list_price, min_price, 10)⇒
 "Sale" 
from PRODUCT_INFO
where SUPPLIER_ID = 6009;