Using Transaction Controlled Statements: Quiz

1.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?
* One 

2.How many INSERTs can you have in one transaction?
*As many as you want until you do a COMMIT or ROLLBACK. 

3.In a PL/SQL block, where can you code a COMMIT statement?
In the Executable and/or the Exception sections.

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?
      *aardvaarks and cool cats

Comments