PL/SQL Collections Flashcards
Which collections allow holes?
AA, NT
Which collections do not allow holes?
VA
Which collections are empty at declaration?
AA
Which collections are NULL at declaration?
NT, VA
Which collections have a fixed capacity?
VA
Which collections have a capacity that’s not set?
AA, NT
What types of indexing do each collection have?
AA: Integers, Strings
NT: Integers
VA: Integers
What is an associative array (AA)?
A set of key-value pairs where each key is unique and is used to locate the corresponding value
What is the basic syntax of creating an AA?
TYPE type_name IS TABLE OF element_type INDEX BY index_type;
table_name type_name;
What is the syntax for adding an element to an AA?
table_name(‘key’) := value;
What is a nested table (NT)?
A one-dimensional array where the array size is dynamic
What is the basic syntax of creating an NT?
TYPE type_name IS TABLE OF element_type;
table_name type_name;
What is the syntax for adding elements to a NT?
table_name := type_name(‘elem1’, ‘elem2’);
What are some of the collection methods PL/SQL provides for AA’s and NT’s?
- FIRST
- LAST
- PRIOR(i)
- NEXT(i)
- DELETE(i)
- COUNT
- EXISTS(I)
- EXTEND
What does the FIRST function do?
Returns the index of the first element