Vous êtes sur la page 1sur 5

1.

Which is
the Mark for Review
correct (1) Points
order for
the
execution
flow of
SQL?

Parse
Bind
Execute
Fetch
(*)
Execute
Parse
Fetch
Bind
Bind
Parse
Execute
Fetch
Parse
Fetch
Bind
Execute

Incorrect. Refer to Section 12 Lesson 1.

2. Only one call to DBMS_SQL is needed in order to drop a table. True or False?
Mark for Review
(1) Points

True
False (*)

Correct

3. Dynamic SQL enables data-definition, data-control, or session-control statements


to be written and executed from PL/SQL. Mark for Review
(1) Points

True (*)
False

Correct

4. Name two reasons for using Dynamic SQL.


Mark for Review
(1) Points

(Choose all correct answers)


Allows fetch of data for DML statements.
Enables session-control statements to be written and executed from PL/SQL.
(*)
Provides the ability to handle mutating rows when executing a statement
involving the same table.
Provides the ability to execute SQL statements whose structure is unknown
until execution time. (*)

Incorrect. Refer to Section 12 Lesson 1.

5. Name two reasons for using Dynamic SQL.


Mark for Review
(1) Points

(Choose all correct answers)

Creates a SQL statement with varying column data, or different conditions


(*)
Enables system control statements to be written and executed from PL/SQL
Enables data-definition statements to be written and executed from PL/SQL
(*)
Avoids errrors at compile time of DML statements

Correct
6. When SQL
statements Mark for Review
are (1) Points
included
within a
procedure,
the
statements
are parsed
when the
procedure
is
compiled.
True or
False?

True (*)
False

Correct

7. Examine the following code:


Mark for Review
CREATE OR REPLACE PROCEDURE myproc IS (1) Points
CURSOR c_curs IS SELECT view_name FROM user_views;
BEGIN
FOR v_curs_rec IN c_curs LOOP
EXECUTE IMMEDIATE 'DROP VIEW ' || v_curs_rec.view_name;
END LOOP;
END;

What will happen when this procedure is invoked?

The procedure will not compile successfully because the syntax of


EXECUTE IMMEDIATE is incorrect.
The procedure will raise an exception because one of the views is a
complex view.
The procedure will raise an exception because Dynamic SQL can drop
tables but cannot drop views.
All views in the user's schema will be dropped. (*)

Correct

8. What is the correct syntax to use the RETURNING phrase at Position A?


Mark for Review
DECLARE (1) Points
TYPE EmpRec IS RECORD (last_name employees.last_name%TYPE, salary
employees.salary%TYPE);
emp_info EmpRec;
emp_id NUMBER := 100;
BEGIN
UPDATE employees
SET salary = salary * 1.1 WHERE employee_id = emp_id
-- Position A
dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who
now makes ' || emp_info.salary);
END;

RETURNING last_name, salary INTO emp_info; (*)


RETURNING last_name, salary TO emp_info;
RETURNING FROM emp_info;
last_name, salary RETURNING INTO emp_info;

Incorrect. Refer to Section 12 Lesson 2.

9. FORALL can only be used with the INSERT statement. True or False?
Mark for Review
(1) Points

True
False (*)

Correct
10. You want to take make a copy of all the cities in the world listed in the cities
table, which contains millions of rows. The following procedure accomplishes Mark for Review
this efficiently. True or False? (1) Points

CREATE OR REPLACE PROCEDURE copy_cities IS


TYPE t_cities IS TABLE OF cities%ROWTYPE INDEX BY BINARY_INTEGER;
v_citiestab t_emp;
BEGIN
SELECT * BULK COLLECT INTO v_citiestab FROM cities;
FORALL i IN v_citiestab.FIRST..v_citiestab.LAST
INSERT INTO new_cities VALUES v_citiestab(i);
END copy_cities;

True (*)
False

Correct
11. What
are Mark for Review
benefits (1) Points
of using
the
NOCOPY
hint?
(Choose
two)

(Choose all correct answers)

Efficient since it uses less memory (*)


Faster because a single copy of the data is used (*)
Safer because it uses passing by value
Uses a larger block of server memory for faster access

Incorrect. Refer to Section 12 Lesson 2.

12. Where would you place the BULK COLLECT statement in the following example?
Mark for Review
DECLARE (1) Points
TYPE DeptRecTab IS TABLE OF departments%ROWTYPE;
dept_recs DeptRecTab;
CURSOR c1 IS
SELECT department_id, department_name, manager_id, location_id
-- Position A
FROM departments
WHERE department_id > 70;
BEGIN
OPEN c1
-- Position B;
FETCH c1
-- Position C
INTO dept_recs;
END;

Position A
Position B
Position C (*)

Incorrect. Refer to Section 12 Lesson 2.

13. FORALL can be used with any DML statement. True or False?
Mark for Review
(1) Points

True (*)
False

Correct

14. Deterministic means the function will always return the same output return value
for any given set of input argument values. True or False? Mark for Review
(1) Points

True (*)
False

Correct

15. In the following example, where do you place the phrase BULK COLLECT?
Mark for Review
... (1) Points
BEGIN
SELECT -- Position A
salary -- Position B
INTO v_saltab -- Position C
FROM employees WHERE department_id = 20 ORDER BY salary
-- Position D
;
...

Position A
Position B (*)
Position C
Position D

Correct

Vous aimerez peut-être aussi