NULL Value in Oracle Database

Source: Internet
Author: User

When we do not know the specific data, it is unknown. We can use null. We call it null. The column length of a table containing null values in Oracle is zero.

Oracle allows null data types. In addition to the primary key field pk, the restriction condition field not null has been added during the definition.

Note:

It is equivalent to no value, which is unknown.

Null and 0, empty strings, and spaces are different.

The operation result of adding, subtracting, multiplication, and Division null values is null.

The nvl function can be used to process null values.

Use is null and is not null for comparison.

NULL values cannot be indexed. Therefore, some qualified data may not be available during the query.

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

Sorting is larger than other data (index sorting by default is descending, small to large), so null is at the end

Select 1 from dual where null = null; row not selected

No records found

Select 1 from dual where null = ''; row not selected

No records found

Select 1 from dual wehre ''=''; row not selected

No records found

Select 1 from dual where null is null; row not selected

No records found

The result of the addition, subtraction, multiplication, and division operation on null values is still null.

Select 1 + null from dual;

Select 1-null from dual;

Select 1 * null from dual;

Select 1/null from dual;

A record is queried, which is the null value in the SQL statement.

Oracle null usage. null is null, Which is incomparable with other types.

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.