Chapter 17 Triggers


Lab 17.1 Self-Review Answers

A5:

Questions

Answers

Comments

1)

C

 

2)

B

Once a trigger has been defined on a particular table, it fires implicitly when a triggering event occurs. By default, when a trigger is created it is also enabled. Once you disable a trigger, it will not fire when a triggering event occurs.

3)

A

The WHEN condition controls when a trigger should fire. If such a condition does not evaluate to TRUE, the trigger will not fire.

4)

C

 

5)

D

A trigger fires before or after a triggering event : INSERT, UPDATE, or DELETE. A SELECT operation is not a triggering event. It reads information from a triggering table without modifying it.


Lab 17.2 Self-Review Answers

A5:

Questions

Answers

Comments

1)

A

 

2)

B

A statement trigger fires once per DML statement issued. In other word, if there is a statement trigger that fires before an UPDATE statement is issued against a triggering table, it will fire once regardless of number of rows affected by the UPDATE statement.

3)

B

 

4)

B

It is important to remember that even though an INSTEAD OF trigger is defined on a view, it manipulates underlying database tables.

5)

B

An INSTEAD OF trigger can never be a statement trigger.


Lab 17.3 Self-Review Answers

A5:

Questions

Answers

Comments

1)

B

You cannot issue an SQL statement against the triggering table in the body of the trigger.

2)

B

Any SQL statement (INSERT, UPDATE, DELETE, and SELECT) against the triggering table inside the body of the trigger will cause a mutating table error.

3)

B

You are able to issue SQL statements against any table but the triggering table in the body of a trigger. In other words, it there is a trigger defined on the STUDENT table, you can issue a SELECT statement against the ZIPCODE table in the body of the trigger. This will not cause any error. However, if you issue a SELECT statement against the STUDENT table, you will get a mutating table error when the trigger fires. You will recall that a mutating table error is a runtime error and is not be detected by the PL/SQL compiler.

4)

C

 

5)

C

You will recall that a constraining table restriction is applicable to Oracle versions prior to 8i.




Oracle PL[s]SQL by Example
Oracle PL[s]SQL by Example
ISBN: 3642256902
EAN: N/A
Year: 2003
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net