Sunteți pe pagina 1din 3

Test: Quiz: Improving PL/SQL Performance Bekijk uw antwoorden, feedback en scores hieronder.

Een asterisk (*) geeft een goed antwoord aan. Section 1 (Beantwoord alle vragen in deze sectie.) 1. The following statement is a valid example of using the RETURNING clause. True or False? DECLARE 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 RETURNING last_name, salary INTO emp_info; dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' || emp_info.salary); END; Waar (*) Niet waar Correct 2. In the following example, where do you place the phrase DETERMINISTIC? CREATE OR REPLACE FUNCTION total_sal (p_dept_id IN -- Position A employees.department_id%TYPE) RETURN NUMBER -- Position B IS v_total_sal NUMBER; BEGIN SELECT SUM(salary) INTO v_total_sal FROM employees WHERE department_id = p_dept_in; RETURN v_total_sal -- Position C; END total_sal; Position A Position B (*) Position C Correct 3. The following procedure compiles successfully. True or False? CREATE OR REPLACE PACKAGE emp_pkg IS TYPE t_emp IS TABLE OF employees%ROWTYPE INDEX BY BINARY_INTEGER; PROCEDURE emp_proc (p_small_arg IN NUMBER, p_big_arg NOCOPY OUT t_emp); ... END emp_pkg; Waar Niet waar (*) Correct 4. A function-based index may be made using your own functions, but only if the function is created using the DETERMINISTIC clause. True or False? Markeren voor nakijken Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten

(1) Punten Waar (*) Niet waar Correct 5. What is wrong with this code example? CREATE OR REPLACE PROCEDURE insert_emps IS TYPE t_emp IS TABLE OF employees%ROWTYPE INDEX BY BINARY_INTEGER; v_emptab t_emp; BEGIN FORALL i IN v_emptab.FIRST..v_emptab.LAST INSERT INTO employees VALUES v_emptab(i); END LOOP; END insert_emps; The phrase should be FOR ALL. v_emptab is incorrectly typed. FORALL does not require END LOOP. (*) Nothing is wrong; it will compile successfully. Correct 6. In the following example, where do you place the phrase BULK COLLECT? DECLARE TYPE NameList IS TABLE OF emp.ename%TYPE; names NameList; CURSOR c1 IS SELECT ename -- Position A FROM emp WHERE job = 'CLERK'; BEGIN OPEN c1; FETCH c1 -- Position B INTO -- Position C names; ... CLOSE c1; END; Position A Position B (*) Position C Correct 7. FORALL can only be used with the INSERT statement. True or False? Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten

Waar Niet waar (*) Correct 8. In the following example, where do you place the phrase BULK COLLECT? ... Markeren voor nakijken (1) Punten

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 9. What is the main purpose for using the RETURNING clause? Markeren voor nakijken (1) Punten

Improve performance by returning a single value. Improve performance by minimizing the number of statements. Improve performance by making one call to the SQL engine. (*) Return more readily any exceptions that are raised by the statement. Correct 10. What are benefits of using the NOCOPY hint? (Choose two) Markeren voor nakijken (1) Punten

(Kies alle goede antwoorden.) Safer because it uses passing by value. Efficient since it uses less memory. (*) Uses a larger block of server memory for faster access. Faster because a single copy of the data is used. (*) Correct

S-ar putea să vă placă și