Anda di halaman 1dari 2

Test: Quiz: Using Transaction Control Statements 1. In a PL/SQL block, where can you code a COMMIT statement?

Review (1) Points Mark for

In any section of the block: Declaration, Executable, or Exception. Only the Executable section. In the Executable and/or the Exception sections. (*) Nowhere; the COMMIT statement must be outside the block.

Correct 2. How many transactions are in the following block? BEGIN INSERT INTO countries (country_id, country_name) VALUES ('XA', 'Xanadu'); INSERT INTO countries (country_id, country_name) VALUES ('NV', 'Neverland'); UPDATE countries SET country_name='Deutchland' WHERE country_id='DE'; UPDATE countries SET region_id=1 WHERE country_name LIKE '%stan'; END; How many transactions are shown above? Mark for Review (1) Points Four; each DML is a separate transaction Two; both the INSERTs are one transaction and both the UPDATEs are a sec ond transaction. It depends on how many rows are updated - there will be a separate trans action for each row. One (*)

Correct 3. How many INSERTs can you have in one transaction? (1) Points Mark for Review

One As many as you want until you do a COMMIT or ROLLBACK. (*) As many as you can execute before the database does an AUTOSAVE. As many as you want until a different DML statement (UPDATE, DELETE or M ERGE) is executed.

Correct 4. Examine the following code: BEGIN INSERT INTO animals VALUES ('aa','aardvarks'); SAVEPOINT sp_1; INSERT INTO animals VALUES ('bb','big birds'); SAVEPOINT sp_2; ROLLBACK TO sp_1; INSERT INTO animals VALUES ('cc','cool cats'); COMMIT; END; Which row(s) will be in the ANIMALS table after this block is executed? Mark for Review (1) Points cool cats big birds and cool cats aardvaarks and cool cats (*) aardvaarks, big birds and cool cats

Correct