You are on page 1of 4

Test: Quiz: Creating DML Triggers - Part ll Bekijk uw antwoorden, feedback en scores hieronder.

Een asterisk (*) geeft een goed antwoord aan. Section 1 (Beantwoord alle vragen in deze sectie.) 1. The OLD and NEW qualifiers can be used with statement triggers as well as row triggers. True or False? Waar Niet waar (*) Correct 2. 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.) (Kies alle goede antwoorden.) (:OLD.employee_id, :OLD.job_id); (:OLD.employee_id, :NEW.job_id); (*) (:NEW.employee_id, :OLD.job_id); (:NEW.employee_id, :NEW.job_id); (*) (NEW.employee_id, NEW.job_id); Correct 3. A row trigger has been created which is fired by UPDATE ON employees. A user now executes a single SQL statement which updates four rows of the EMPLOYEES table. How many times will the row trigger fire? Once Twice Four times (*) Five times Eight times Correct 4. Examine the following code. To create a row trigger, what code should be included at Line A? CREATE OR REPLACE TRIGGER del_emp_trigg BEFORE DELETE ON employees ---- Line A BEGIN ... FOR EVERY ROW Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten

After each row. Before the triggering statement. After each row. Departments 50 and 80 exist but department 81 does not.some action END BEFORE EACH ROW. (*) Before the triggering statement. Markeren voor nakijken (1) Punten .80.PUT_LINE('Sample Message'). After the triggering statement. The following view and trigger have been created: CREATE VIEW dept_view AS SELECT * FROM departments. No rows are updated and "Sample Message" is displayed twice. What happens? Two rows are updated and "Sample Message" is displayed once. Before each row. Correct 6. CREATE OR REPLACE TRIGGER dept_view_trigg INSTEAD OF UPDATE ON dept_view BEGIN DBMS_OUTPUT. Before the triggering statement. After the triggering statement. Correct 5. END. After the triggering statement. BEFORE EACH ROW IS BEGIN -.FOR EACH ROW (*) FOR EVERY ROW FOR ALL ROWS Nothing is needed because DML triggers are row triggers by default. After the triggering statement. None of the above. (*) No rows are updated and "Sample Message" is displayed three times.81). No rows are updated and "Sample Message" is displayed once. Instead of the triggering statement. What are the timing events for a compound trigger? Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten Before the triggering statement. Correct 7. What is wrong with this compound trigger example? CREATE OR REPLACE TRIGGER compound_trigger FOR UPDATE OF salary COMPOUND TRIGGER threshold CONSTANT SIMPLE_INTEGER := 200. A user now executes the following statement: UPDATE dept_view SET department_name = 'Sales' WHERE department_id IN (50. Before each row.

like %ROWCOUNT and %NOTFOUND Correct 9.) They can be created on a table. AFTER STATEMENT IS BEGIN -. (*) They can be row triggers. Correct 8. (*) They are special cursor attributes. They are automatically declared boolean variables which allow the trigger body to detect which DML operation is being executed. but allow Markeren voor nakijken (1) Punten Markeren voor nakijken (1) Punten . They can be statement triggers. ELSE INSERT INTO log_table values (USER. Correct 10. Which of the following statements about INSTEAD OF triggers are NOT true? (Choose two. Missing the EXCEPTION section. END compound_trigger. (*) They can be created on a simple view.) (Kies alle goede antwoorden. SYSDATE). (*) Missing the INSTEAD OF timing section. They allow the trigger code to see what data values are being inserted into a row.some action END AFTER STATEMENT. Which of the following best describes conditional predicates in a trigger? Markeren voor nakijken (1) Punten They are special variables which must be DECLAREd within the trigger. END IF.Line A RAISE_APPLICATION_ERROR('Cannot update salary'). END. Missing name of table on which the trigger fires.some action END AFTER EACH ROW. Missing the BEFORE and INSTEAD OF timing sections.AFTER EACH ROW IS BEGIN -. You want the trigger to prevent updates to the SALARY column. Missing BEFORE timing statement. They can be created on a complex view. You decide to create the following trigger: CREATE OR REPLACE TRIGGER empl_trigg BEFORE UPDATE ON employees BEGIN -.

What should you code at Line A? IF UPDATING SALARY THEN IF UPDATING('SALARY') THEN (*) IF UPDATE('SALARY') THEN IF UPDATING(SALARY) THEN IF UPDATE(SALARY) THEN Correct .updates to all other columns.