Difference between revisions of "EVL()"

From Lianjapedia
Jump to: navigation, search
(Created page with '==Purpose== Function to specify an alternative value for an empty expression ==Syntax== EVL(<expr1>,<expr2>) ==See Also== EMPTY(), ETOS(), IFNULL(), ISNULL(), […')
 
 
Line 20: Line 20:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Expressions and Type Conversion]]
+
[[Category:Formatting Functions]]
[[Category:Expressions and Type Conversion Functions]]
+

Latest revision as of 08:05, 4 February 2013

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