Você está na página 1de 5

Test: Quiz: Creating DDL and Database Events Triggers Bekijk uw antwoorden, feedback en scores hieronder.

Een asterisk (*) geeft een goed antwoord aan.

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.

Correct

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 (*)

Correct

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 the following trigger: CREATE OR REPLACE TRIGGER log_942_trigg AFTER SERVERERROR ON DATABASE BEGIN -- Line A INSERT INTO log_table VALUES ( ...); END;

Markeren voor nakijken (1) Punten

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

Correct

4. User HARJIT wants to prevent any objects which he owns from being dropped. Harjit decides to execute the following code: 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

Markeren voor nakijken (1) Punten

Correct

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 False?

Markeren voor nakijken (1) Punten

Waar Niet waar (*)

Correct

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. (*)

Correct

7. The database administrator creates a trigger that automatically disconnects user HACKER whenever HACKER connects to the database. What type of trigger is this?

Markeren voor nakijken (1) Punten

A DDL trigger A Database Event trigger (*) A DML trigger A statement trigger An INSTEAD OF trigger

Correct

8. What is wrong with the following code? CREATE OR REPLACE TRIGGER call_trigg AFTER UPDATE OR DELETE ON employees BEGIN CALL del_emp_proc END;

Markeren voor nakijken (1) Punten

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.

Correct

9. What is wrong with the following code? CREATE OR REPLACE TRIGGER emp_dml_trigg 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.

Markeren voor nakijken (1) Punten

Correct

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

Correct

Você também pode gostar