This shows you the differences between two versions of the page.
— |
dev:sql:functions:nullif [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{page>:top_add&nofooter&noeditbtn}} | ||
+ | {{page>:sql_bar&nofooter&noeditbtn}} | ||
+ | ====== Omnidex SQL Function: NULLIF ====== | ||
+ | ===== Description ===== | ||
+ | The NULLIF function tests to see if the first expression is equal to the second expression, and returns the first expression if they are not equal and NULL if they are equal. | ||
+ | |||
+ | This function returns the same datatype as the first expression, or NULL if the two expressions are equal. | ||
+ | |||
+ | ===== Syntax ===== | ||
+ | |||
+ | NULLIF( expression_1, expression_2 ) | ||
+ | |||
+ | |||
+ | == expression_1 and expression_2 == | ||
+ | |||
+ | Required. An expression using SQL language that produces a value. A scalar expression is generally equivalent to a select item in the SQL SELECT statement, and can be a character expression, numeric expression or date expression. | ||
+ | |||
+ | ===== Example ===== | ||
+ | ==== Example 1: NULLIF against columns ==== | ||
+ | |||
+ | <code> | ||
+ | > select NULLIF(name, individual) identifier from individuals; | ||
+ | |||
+ | IDENTIFIER | ||
+ | -------------------------------------------------- | ||
+ | MS. MARY LEWIS | ||
+ | MRS. ALICE R TOLLIVER | ||
+ | MR. SIDNEY K TOLLIVER | ||
+ | MRS. JENNIFER J HOPKINS | ||
+ | MR. CHARLIE HOPKINS | ||
+ | MS. KIMBERLY BLUE | ||
+ | KATHLEEN TUCKER | ||
+ | </code> | ||
+ | |||
+ | ====== Additional Resources ====== | ||
+ | |||
+ | See also: | ||
+ | {{page>dev:sql:functions:see_also_logic&noheader&nofooter&noeditbtn}} | ||
+ | |||
+ | |||
+ | {{page>:bottom_add&nofooter&noeditbtn}} | ||
+ | |||
+ | ===== | ||