23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

NULLIF<br />

Syntax<br />

Compatibility<br />

ODBC compatible<br />

NULLIF<br />

Returns a NULL value for expression1 if it is equal to expression2. It is useful for converting<br />

values to NULL from applications that use some other representation for missing or unknown<br />

data. The NULLIF scalar function is a type of conditional expression.<br />

Example This example uses the NULLIF scalar function to insert a NULL value into an address column if<br />

the host-language variable contains a single space character:<br />

Notes • This function is not allowed in a GROUP BY clause.<br />

NVL<br />

Syntax<br />

NULLIF ( expression1, expression2 )<br />

INSERT INTO employee (add1) VALUES (NULLIF (:address1, ' '));<br />

• Arguments to this function cannot be query expressions.<br />

• The NULLIF expression is shorthand notation for a common case that can also be<br />

represented in a CASE expression, as shown:<br />

CASE<br />

WHEN expression1 = expression2 THEN NULL<br />

ELSE expression1<br />

END<br />

Compatibility<br />

<strong>SQL</strong> compatible<br />

Returns the value of the first expression if the first expression value is not NULL. If the first<br />

expression value is NULL, the value of the second expression is returned.<br />

NVL ( expression , expression )<br />

Example This example illustrates the NVL function:<br />

SELECT salary + NVL (comm, 0) 'TOTAL SALARY' FROM employee ;<br />

111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!