PL/SQL Collections Flashcards

1
Q

Which collections allow holes?

A

AA, NT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which collections do not allow holes?

A

VA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which collections are empty at declaration?

A

AA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which collections are NULL at declaration?

A

NT, VA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which collections have a fixed capacity?

A

VA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which collections have a capacity that’s not set?

A

AA, NT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What types of indexing do each collection have?

A

AA: Integers, Strings
NT: Integers
VA: Integers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an associative array (AA)?

A

A set of key-value pairs where each key is unique and is used to locate the corresponding value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the basic syntax of creating an AA?

A

TYPE type_name IS TABLE OF element_type INDEX BY index_type;

table_name type_name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the syntax for adding an element to an AA?

A

table_name(‘key’) := value;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a nested table (NT)?

A

A one-dimensional array where the array size is dynamic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the basic syntax of creating an NT?

A

TYPE type_name IS TABLE OF element_type;

table_name type_name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the syntax for adding elements to a NT?

A

table_name := type_name(‘elem1’, ‘elem2’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are some of the collection methods PL/SQL provides for AA’s and NT’s?

A
  • FIRST
  • LAST
  • PRIOR(i)
  • NEXT(i)
  • DELETE(i)
  • COUNT
  • EXISTS(I)
  • EXTEND
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the FIRST function do?

A

Returns the index of the first element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the LASTfunction do?

A

Returns the index of the last element

17
Q
What does the PRIOR(i)
function do?
A

Returns the index of the element that comes before index i

18
Q

What does the NEXT(i) function do?

A

Returns the index of the element that comes

after index i

19
Q

What does the DELETE(i) function do?

A

Deletes the element at index i

20
Q

What does the COUNT function do?

A

Returns the number of elements

21
Q

What does the EXISTS(i) function do?

A

Returns true/false if element i exists

22
Q

Which PL/SQL collection has sparse indexing?

A

AAs

23
Q

Which PL/SQL collection starts with dense indexing (at 1)?

A

NTs

24
Q

What does the EXTEND function do?

A

Appends one null element to a collection

25
Q

What is are Varrays?

A

A 1D array whose number of elements can vary from zero (empty) to the declared maximum size

26
Q

What is the basic syntax of creating a Varrays?

A

TYPE type_name IS VARRAY(size) OF element_type;

table_name type_name;

27
Q

What is the syntax for adding elements to a Varray?

A

table_name.EXTEND;

table_name (index) := value;