Analysis of oracle nvl Functions

Source: Internet
Author: User

Nvl functions of Oracle

 

Nvl () function

Returns a non-null value from two expressions.

 

Syntax

NVL (eExpression1, eExpression2)

 

Parameters

EExpression1, eExpression2

 

If the eExpression1 calculation result is null, NVL () returns eExpression2. If the calculation result of eExpression1 is not null, eExpression1 is returned. EExpression1 and eExpression2 can be any data type. If both eExpression1 and eExpression2 are null values, NVL () returns. NULL ..

 

Return Value Type

Numeric, currency, logical, or null

 

Description

If null or null values are not supported, you can use NVL () to remove null values in the calculation or operation.

Select nvl (a. name, 'blank ') as name from student a joinschool B on a. ID = B. ID

 

Note: The two parameters must be of the same type.

 

 

 

Q: What is NULL?

A: When we do not know the specific data, it is also unknown. NULL can be used,

We call it null. in ORACLE, the column containing null values has zero length.

 

 

ORACLE allows blank fields of any data type, except for the following two cases:

1. primary key field (primary key ),

2. fields with the not null restriction added during definition

Note:

1. It is equivalent to no value and is unknown.

2. NULL and 0, empty strings, and spaces are different.

3. add, subtract, multiply, and divide null values. The result is still null.

4. The NVL function is used for NULL processing.

5. Use the keyword "is null" and "is not null" for comparison ".

6. null values cannot be indexed. Therefore, some data that meets the query conditions may not be found,

In count (*), use nvl (column name, 0) for processing and then query.

7. Sorting is larger than other data (indexes are sorted in descending order by default, small → large ),

Therefore, the NULL value is always at the end.

Related Article

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.