Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2K views

Using Transaction Control Statements

This document contains a quiz about transaction control statements in PL/SQL. The questions ask about where COMMIT statements can be placed, the number of transactions in a code block with multiple DML statements, the number of INSERT statements that can be in one transaction, and which rows will remain after a block with SAVEPOINTs and a ROLLBACK is executed.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Using Transaction Control Statements

This document contains a quiz about transaction control statements in PL/SQL. The questions ask about where COMMIT statements can be placed, the number of transactions in a code block with multiple DML statements, the number of INSERT statements that can be in one transaction, and which rows will remain after a block with SAVEPOINTs and a ROLLBACK is executed.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like