Understanding nested tables, PL-SQL Programming

Understanding Nested Tables

Within the database, the nested tables can be considered as one-column database tables. The Oracle stores the rows of a nested table in no specific order. But, when you retrieve the nested table into the PL/SQL variable, the rows are given consecutive subscripts starting at 1. That provides you array-like access to the individual rows.

Within PL/SQL, the nested tables are like one-dimensional arrays. Though, nested tables differ from arrays in two significant ways. Firstly, the arrays have a fixed upper bound, but nested tables are unbounded .Therefore, the size of a nested table can increase dynamically.

 

150_Understanding Nested Tables.jpg

                                   Figure: Array versus Nested Table


Secondly, the arrays should be dense (having consecutive subscripts). Therefore, you cannot delete individual elements from an array. Initially, the nested tables are dense, but they can be sparse (having nonconsecutive subscripts). And hence, you can delete elements from a nested table using the built-in procedure DELETE. That might leave gaps in the index, but the built-in function NEXT iterate over any series of subscripts.

Posted Date: 10/3/2012 6:28:57 AM | Location : United States







Related Discussions:- Understanding nested tables, Assignment Help, Ask Question on Understanding nested tables, Get Answer, Expert's Help, Understanding nested tables Discussions

Write discussion on Understanding nested tables
Your posts are moderated
Related Questions
Find the account numbers of all customers whose balance is more than 10,000 $

Rephrase Conditional Control Statements When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops evaluating the expression as s

MERGE and TRUNCATE in SQL SQL has two more table update operators, MERGE and TRUNCATE. MERGE, like INSERT, takes a source table s and uses it to update a target table t. Brief

Use of COUNT in SQL It describes and discusses various general methods of expressing constraints, eventually noting that support for "=" with relation operands is sufficient f

Effects of NULL for Multiple Assignments - SQL If the row expression given as the source for a multiple assignment evaluates to NULL, then NULL is assigned to each target. If

Aggregate Operators SQL Supports all of the aggregate operators mentioned in the theory book and many more besides. The syntax, however, involves an unusual trick that SQL cal

Description: Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that pr

LEVEL You use the LEVEL with the SELECT CONNECT BY statement to categorize rows from a database table into a tree structure. The LEVEL returns the level number of a node in a

Multiple Assignment- SQL SQL supports multiple assignment to local variables and also applies multiple assignment semantics in SET clauses of UPDATE statements, but does not

Using Pragma RESTRICT_REFERENCES: The function called from the SQL statements should obey certain rules meant to control the side effects. To check for violation of the rules,