Sexy chat cell - Updating nested table

The first SELECT statement on Line 3 simply selects the number 1 (as a sort order), the rownum column and the empname column.The second SELECT statement on Line 8 selects the number 2, rownum and column_value keyword from the addr Nested Table column type.

Add another employee to the database using the format for the Nested Table by calling the Type emp_addr.

A UNION ALL select statement with a couple of adjustments to query only Employee with empid 2 (Lines 7 and 12) will prove that the addition was successful.

This article describes how to create and use the single dimensional structures known as nested tables.

These collections can be used in PL/SQL code as types or as types within Tables.

Nested Table Type Topics include: creating a table with this type, inserting a record with this type and updating a record with this type.

To get started using a Nested Table, create a code block that declares a nested table type and instantiates a nested table of this created type (Lines 2 & 4).

The next example declares a type of Nested Table on line 2 and then declares a variable of this new type, Animal_Table on line 3 again.

This time, the values of the array and the size of the array are not instantiated.

A 2nd loop at line 22 iterates through the nested table to output the values. The next section creates a Nested Table type in the database schema for use as a column in a Table. Then the Table is created with an ID, Name and an address of the Nested Table type created.

Tags: , ,