Oracle null values

Source: Internet
Author: User

Copyright statement: You can reprint it at will, but the original author charlee and original link http://tech.idv2.com/2005/06/03/oracle-null-info/must be identified in a timely manner.

The null value is not equal to 0 or null, indicating that the value is not fixed.

When any operation (addition, subtraction, multiplication, division, string connection, etc.) contains null values, the value of the entire expression is null. Use a single row function to process the null value. The result is also null (except for functions such as nvl ).

However, the Boolean operation result of the null value is not necessarily null, except that false and null are false, true or null are true. This is because in the and operation, if one operation is false, the result is false. Even if the other operation is null, the result must be false. In the or operation, if one operation is true, the result is true.

All grouping functions ignore null values.

During sorting, null is considered as the largest value. In positive order, null is shown at the bottom, and in reverse order, null is displayed at the top.

Functions that process null values include the following:

Nvl (parameter 1, parameter 2): If parameter 1 is not null, parameter 1 is returned. If parameter 1 is null, parameter 2 is returned.
Nvl2 (parameter 1, parameter 2, parameter 3): If parameter 1 is not null, parameter 2 is returned. If parameter 1 is null, parameter 3 is returned. The type of the return value of this function is always the same as that of parameter 2. When parameter 1 is null, Oracle converts parameter 3 to the Data Type of parameter 2 and returns the result.
Nullif (parameter 1, parameter 2): If parameter 1 is equal to parameter 2, null is returned. If parameter 1 is not equal to parameter 2, parameter 1 is returned.
Coalesce (parameter 1, parameter 2,..., parameter n): returns the first non-null value from parameter 1 to parameter n.

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.