Which statement is true about the outcome on executing the above PL/SQL block?

View the Exhibit and examine the structure of the EMPLOYEES table.

Examine the following PL/SQL block:
DECLARE
TYPE EmpList
IS VARRAY(2) OF employees.employee_id%TYPE NOT NULL;
v_employees EmpList := EmpList();
BEGIN
DBMS_OUTPUT.PUT_LINE(v_employees.COUNT);
v_employees.EXTEND;
v_employees(1) := 30;
END;
/
Which statement is true about the outcome on executing the above PL/SQL block?

View the Exhibit and examine the structure of the EMPLOYEES table.

Examine the following PL/SQL block:
DECLARE
TYPE EmpList
IS VARRAY(2) OF employees.employee_id%TYPE NOT NULL;
v_employees EmpList := EmpList();
BEGIN
DBMS_OUTPUT.PUT_LINE(v_employees.COUNT);
v_employees.EXTEND;
v_employees(1) := 30;
END;
/
Which statement is true about the outcome on executing the above PL/SQL block?

A.
It executes successfully and displays the value 2.

B.
It executes successfully and displays the value 0.

C.
It generates an error because EXTEND cannot be used for varrays.

D.
It generates an error because the declaration of the varray is not valid.



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Leo Yu

Leo Yu

Notes
1) delete keep the placeholder of deleted element, so you can assign one value to the deleted element
2) trim doesn’t keep the placeholder, if trim encountered deleted element, trim include it in its tally.
3) deleted element is not included in .count

gelete

gelete

B.
EXTEND is one of the Oracle PL/SQL collection methods which is used with Nested Tables and VARRAYS
to append single or multiple elements to the collection.
1. EXTEND, which adds a single NULL instance.
2. EXTEND(n) which adds multiple NULL instances. The number of instances is specified by n.
3. EXTEND(n,m) which appends n copies of cell m to the collection.

http://psoug.org/definition/EXTEND.htm