Oracle exception [ORA-22908: NULL Table value reference] Problem Analysis and Solution

Source: Internet
Author: User
Oracle exception [ORA-22908: NULL Table value reference] Problem Analysis and Solution

Oracle exception [ORA-22908: NULL Table value reference] Problem Analysis and Solution

The scenario is as follows:

Type list_obj; test (name (regexp_like (name,), id, version_list list_obj) nested table version_list store as version_list;

Scenario Description: The list_obj type is a list of numbers with equivalent elements. Table test has three fields. The field name is a string consisting of only lowercase letters, numbers, and underscores. The field id is a number and cannot be empty; the version_list field is a nested table of the list_obj type.

Operation 1:

Test (name, id), 1 );

The query result is as follows:

Currently, version_list is empty (Note: It is null). Now we need to maintain this field: Insert a version 20130403112459 to the record. The statement is as follows:

() Values (20130403112459 );

If you execute the preceding insert statement, an error is returned!

Why? The version_list field is currently NULL. The preceding insert statement attempts to perform this action: table (NULL), that is, to visualize NULL into a table. This is against common sense. Oracle cannot do it!

How can this problem be solved? The version_list field is NULL because it is not initialized at all. So, can the problem be solved shortly after initialization of insert?

Method 1: Use the following statement to insert data to the test table:

Test (name, id, version_list), 1, list_obj ());

Method 2: Initialize version_list before inserting version numbers.

Test;

See:

This is the query output under pl/SQL developer. Note that the background color of the Data cell in the version_list column is not pale yellow (the field value is null at this time )! Although there is still no record for viewing the internal content of the version_list field, it is different in the sense that it is null before initialization and list_obj object after initialization.

Finished!

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.