Vous êtes sur la page 1sur 3

Test: Quiz: Manipulating Data in PL/SQL 1.

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

Correct 2. Which implicit cursor attribute identifies the number of rows updated in the following statement? DBMS_OUTPUT.PUT_LINE (__________ || ' rows updated.'); Mark for Review (1) Points SQL%COUNT SQL%NUMBER SQL%ROWCOUNT (*) SQLROW%COUNT

Correct 3. 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; Mark for Review (1) Points No rows are updated but the block completes successfully.

Every employee row is updated. (*) An exception is raised because you cannot give a variable the same name as a table column. An exception is raised because the UPDATE statement did not modify any r ows.

Correct 4. Which of the following use an implicit cursor? Mark for Review (1) Points DML statements only. SELECT statements only. DML statements and SELECT statements which return a single row. (*) COMMIT and ROLLBACK statements only.

Correct 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 em ployees SET job_id = 'ST_CLERK' WHERE department_id = 90; IF SQL%FOUND THEN v_op en := 'YES'; END IF; DBMS_OUTPUT.PUT_LINE(v_open || ' ' || SQL%ROWCOUNT); END; Mark for Review (1) Points NO 3 YES 1 YES 3 (*) Nothing will be displayed. The block will fail because you cannot use im plicit cursor attributes directly in a call to DBMS_OUTPUT.PUT_LINE.

Correct 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? Mark for Review (1) Points An implicit cursor named "WF_COUNTRIES". An implicit cursor named "SQL". (*) An explicit cursor named "SQL". An explicit cursor which must be declared and named by the PL/SQL progra mmer.

Correct 7. Which of the following SQL DML commands can be used inside a PL/SQL blo ck? Mark for Review (1) Points INSERT and UPDATE only. UPDATE and DELETE only. INSERT, UPDATE and DELETE only. INSERT, UPDATE, DELETE and MERGE. (*)

Correct

Vous aimerez peut-être aussi