Sei sulla pagina 1di 3

Test: Quiz: Creating DDL and Database Events Triggers

Beantwoord de vraag of vragen op deze pagina en klik daarna op 'Volgende' om naar de volgende testpagina te
gaan. Klik op 'Samenvatting' voor een lijst met de vragen die u moet beantwoorden voordat u de test verstuurt.
Klik op 'Test voltooien' als u de vragen hebt beantwoord en de test wilt versturen.

Section 1
(Beantwoord alle vragen in deze sectie.)
1. Which of the following could NOT cause a DDL or Database Event trigger to
fire? Markeren voor nakijken
(1) Punten
A table is dropped.

A user connects to the database.

The DBA starts up the database.

A user deletes rows from the EMPLOYEES table.

A specific exception is raised in a user's session.

2. You have been granted CREATE TRIGGER privilege. You can now create an
AFTER LOGOFF ON SCHEMA trigger. True or False? Markeren voor nakijken
(1) Punten
Waar

Niet waar

3. The database administrator wants to write a log record every time any
user's session raises an ORA-00942 exception. The DBA decides to create Markeren voor nakijken
the following trigger: (1) Punten

CREATE OR REPLACE TRIGGER log_942_trigg


AFTER SERVERERROR ON DATABASE
BEGIN
-- Line A
INSERT INTO log_table VALUES ( ...);
END;
What should the DBA code at Line A?
IF (SERVERERROR(942)) THEN

IF (IS_SERVERERROR(942)) THEN

IF (SERVERERROR = 942) THEN

IF (IS_SERVERERROR = 942) THEN

IF (IS_SERVERERROR(ORA-00942)) THEN

4. User HARJIT wants to prevent any objects which he owns from being
dropped. Harjit decides to execute the following code: Markeren voor nakijken
(1) Punten
CREATE OR REPLACE TRIGGER stop_drop
---- Line A
BEGIN
RAISE_APPLICATION_ERROR(-20201,'Attempted drop');
END;
What should Harjit code at Line A?
BEFORE DROP ON HARJIT

BEFORE DROP ON TABLE


BEFORE DROP ON SCHEMA
BEFORE DROP ON OWNER

BEFORE DROP ON USER_OBJECTS

5. You can create a trigger which prevents DDL statements on an individual


table, while still allowing DDL on other tables in the same schema. True or Markeren voor nakijken
False? (1) Punten

Waar

Niet waar

6. What is the benefit of using the CALL statement in a trigger body?


Markeren voor nakijken
(1) Punten
It allow both DDL events and database events to be handled by a
single trigger.
It prevents data being read from a mutating table.

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.

7. The database administrator creates a trigger that automatically disconnects


user HACKER whenever HACKER connects to the database. What type of Markeren voor nakijken
trigger is this? (1) Punten

A DDL trigger

A Database Event trigger

A DML trigger

A statement trigger

An INSTEAD OF trigger

8. What is wrong with the following code?


Markeren voor nakijken
CREATE OR REPLACE TRIGGER call_trigg (1) Punten
AFTER UPDATE OR DELETE ON employees
BEGIN
CALL del_emp_proc
END;
When CALL is used, the BEGIN and END; statements should be
omitted.
The CALL statement should end with a semicolon (;)
You cannot use a CALL statement in a DML trigger.

When using CALL, only one DML statement can be tested, so UPDATE
OR DELETE is wrong.
9. What is wrong with the following code?
Markeren voor nakijken
CREATE OR REPLACE TRIGGER emp_dml_trigg (1) Punten
BEFORE UPDATE OF salary ON employees
FOR EACH ROW
DECLARE
v_max_sal employees.salary%TYPE;
BEGIN
SELECT max(sal) INTO v_max_sal FROM employees;
END;
You cannot use a DECLARE statement in a trigger.
The trigger body is reading the same table (employees) that the
triggering event is updating.
You must use RAISE_APPLICATION_ERROR in a BEFORE trigger.

You can never use SELECT inside a DML trigger.

Nothing is wrong, the trigger will execute correctly.

10. Mutating table errors can be caused by DML triggers, but not by database
event triggers. True or False? Markeren voor nakijken
(1) Punten
Waar

Niet waar

Potrebbero piacerti anche