Manipulating Data in PL/SQL: Quiz

1. You can use implicit cursor attributes such as SQL%ROWCOUNT directly inside a DML statement. For example: INSERT INTO log_table VALUES (SYSDATE, USER, SQL%ROWCOUNT); True or False?
*
False

2.Which of the following SQL DML commands can be used inside a PL/SQL block? 
* INSERT, UPDATE, DELETE, and MERGE

3.Which implicit cursor attribute identifies the number of rows updated in the following statement?

   DBMS_OUTPUT.PUT_LINE(__________ || ' rows updated.');

* SQL%ROWCOUNT

4.
Employee_id 999 does not exist. What will happen when the following code is executed? DECLARE employee_id employees.employee_id%TYPE := 999; BEGIN UPDATE employees SET salary = salary * 1.1 WHERE employee_id = employee_id; END;

*
Every employee row is updated.

5.There are three employees in department 90. What will be displayed when the following code is executed? DECLARE v_open CHAR(3) := 'NO'; BEGIN UPDATE employees SET job_id = 'ST_CLERK' WHERE department_id = 90; IF SQL%FOUND THEN v_open := 'YES'; END IF; DBMS_OUTPUT.PUT_LINE(v_open || ' ' || SQL%ROWCOUNT); END; 
* YES 3

6.A PL/SQL block contains the following DML statement: UPDATE wf_countries SET population = population * 1.1 WHERE country_id = 229; Which kind of cursor is used for this statement? 
* An implicit cursor named "SQL".


7.Which of the following use an implicit cursor?
  *DML statements and SELECT statements which return a single row.

Comments