EVL()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to specify an alternative value for an empty expression

Syntax

EVL(<expr1>,<expr2>)

See Also

EMPTY(), ETOS(), IFNULL(), ISNULL(), NVL(), SET NULL, SET NULLDISPLAY

Description

The EVL() function evaluates the expression in <expr1>, and if the expression does not evaluate to an empty value, the evaluated result is returned. If the expression in <expr1> does evaluate to an empty value, the expression in <expr2> is evaluated. If <expr2> does not evaluate to an empty value, the evaluated result is returned. If both <expr1> and <expr2> evaluate to an empty expression, the NVL() function returns 0.

Example

CREATE TABLE contact (firstname c(20), lastname c(20))
INSERT INTO contact (lastname) VALUES ("Smith")
SELECT lastname, evl(firstname,"Unknown") from contact