Section 13
There
are 3 employees in department 90 and 5 employees in department 50. The
following trigger has been created:
CREATE TRIGGER upd_emp_trigg
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
...
A user now executes:
UPDATE employees
SET department_id = 50
WHERE
department_id = 90;
How many times will the trigger fire?
Once
Three
times (*)
Four
times
Five
times
Eight
times
Whenever an employee's JOB_ID
is updated, we want to insert a row into a logging table to record the
employee_id and the new value of JOB_ID. We create a row trigger whose body
includes the following code:
BEGIN
INSERT INTO
logging_table (emp_id, job_id)
VALUES -- Point
A
END;
At point A, which of the following will insert the correct
data into the logging table? (Choose two.)
(Choose
all correct answers)
(:NEW.employee_id,
:NEW.job_id); (*)
(:NEW.employee_id,
:OLD.job_id);
(:OLD.employee_id,
:NEW.job_id); (*)
(NEW.employee_id,
NEW.job_id);
(:OLD.employee_id,
:OLD.job_id);
What are the timing events for
a compound trigger?
Before
the triggering statement; After the triggering statement; Instead of the
triggering statement
Before
the triggering statement; After the triggering statement; After each row
Before
the triggering statement; Before each row; After each row; After the triggering
statement (*)
Before
the triggering statement; Before each row; After the triggering statement
What is the benefit of using
the CALL statement in a trigger body?
It
allows the database administrator to monitor who is currently connected to the
database.
It
allows the trigger body code to be placed in a separate procedure. (*)
It
prevents data being read from a mutating table.
It
allow both DDL events and database events to be handled by a single trigger.
You have been granted CREATE
TRIGGER privilege. You can now create an AFTER LOGOFF ON SCHEMA trigger. True
or False?
True
False
(*)
Examine
this code:
CREATE TRIGGER new_trigg
AFTER CREATE ON reserved_word
BEGIN ...
Which of the following can be used in place of
reserved_word? (Choose two.)
(Choose
all correct answers)
TABLE
employees
TABLE
USER
SCHEMA
(*)
DATABASE
(*)
Which of the following are NOT stored inside the database?
A
sequence
A
PL/SQL package specification
An
index
An
anonymous block (*)
A
database trigger
What type of database object would you create to write an
auditing record automatically every time a user connects to the database?
A
function
A
complex view
A
trigger (*)
A
procedure
A
package
Which of the following are NOT allowed within a database
trigger? (Choose two)
(Choose
all correct answers)
SAVEPOINT
(*)
A call
to a packaged procedure
COMMIT
(*)
A
Boolean variable
INSERT
You need to disable all triggers that are associated with
DML statements on the DEPARTMENTS table. Which of the following commands should
you use?
ALTER
TABLE departments DROP ALL TRIGGERS;
ALTER
TRIGGER DISABLE ALL ON departments;
ALTER
TABLE departments DISABLE ALL TRIGGERS; (*)
ALTER
TABLE departments DISABLE TRIGGERS;
DISABLE
ALL TRIGGERS ON departments;
You can see trigger information in the following Data
Dictionary views except:
USER_SOURCE
(*)
USER_OBJECTS
USER_TRIGGERS
USER_ERRORS
You can
view trigger information in all of these Data Dictionary views.
User KULJIT creates two triggers named EMP1_TRIGG and
EMP2_TRIGG, which are both DML triggers referencing her EMPLOYEES table. Kuljit
now wants to remove both of these triggers from the database. What command(s)
should Kuljit use to do this?
DROP
TRIGGER emp1_trigg;
DROP TRIGGER emp2_trigg;
(*)
DROP
TRIGGERS ON employees;
DROP
ALL TRIGGERS ON employees;
DROP
TRIGGER emp1_trigg AND emp2_trigg;
An AFTER UPDATE trigger can specify more than one column.
True or False?
True
(*)
False
Which of the following are possible keywords for the timing
component of a trigger? (Choose three.)
(Choose
all correct answers)
AFTER
(*)
WHENEVER
INSTEAD
OF (*)
BEFORE
(*)
INSTEAD
We want to create a log record automatically every time any
DML operation is executed on either or both of the EMPLOYEES and DEPARTMENTS
tables. What is the smallest number of triggers that must be create to do this?
One
Two (*)
Three
Six
Eight
No comments:
Post a Comment