Oracle NULLIF Function

Source: Internet
Author: User

The Oracle NULLIF function syntax of the Oracle NULLIF function is NULLIF (expression 1, expression 2). If expression 1 and expression 2 are equal, a null value is returned, if expression 1 and expression 2 are not equal, the result of expression 1 is returned. Note: expression 1 and expression 2 should be of the same data type or can be implicitly converted to the same data type. Expression 1 cannot use the character null. Example 1 of www.2cto.com: If sal is 888, a blank [SQL] SQL> select. ename,. sal, nullif (sal, 8888) value from emp; ename sal value ------------------ ---------- SMITH 99 ALLEN 8888 WARD 8888 JONES 8888 MARTIN 8888 BLAKE 8888 CLARK 8888 SCOTT 999 999 KING 8888 TURNER 8888 ADAMS 8888 JAMES 8888 FORD 8888 MILLER 8888 xiangyc 9999.88 9999.88 already select 15 rows. At www.2cto.com, we can see that equal is null. If not, expression 1 is returned. Example 2: [SQL] SQL> select nullif (3 + 5, 8) value from dual; VALUE ---------- Example 3: it is proved that the first expression cannot use the character null [SQL] SQL> select nullif (null, 8) value from dual; select nullif (null, 8) value from dual * 1st line with an error: ORA-00932: Data Type inconsistent: Should be-, but get CHAR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.