Putline there are now a employees end this

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: N Emp_tab FOR EACH ROW DELCARE n INTEGER; BEGIN SELECT COUNT(*) INTO n FROM Emp_tab; DBMS_OUTPUT.PUT_LINE(' There are now ' || a || ' employees,'); END; This trigger results in an error after this SQL statement is entered: DELETE FROM Emp_tab WHERE Empno = 7499; How do you correct the error? A. Change the trigger type to a BEFORE DELETE. B. Take out the COUNT function because it is not allowed in a trigger. C. Remove the DBMS_OUTPUT statement because it is not allowed in a trigger. D. Change the trigger to a statement-level trigger by removing FOR EACH ROW. Answer: D Explanation: A mutating table is a table against which a data manipulation statement has been issued and the corresponding trigger on the DML statement is reading from the same table, at the same time. Mutating tables are not valid for statement triggers because statement triggers fire only once for each event and allow the process to complete before the trigger is actually fired. Row triggers can cause a table to mutate because row triggers fire for each row. To correct this problem you change the trigger to a Statement-Level Trigger by removing FOR EACH ROW or by specifying FOR EACH STATEMENT. Incorrect Answers A. This will still result in an error and it will not achieve the intended result. B. You may use the COUNT function in a Trigger. C. The DBMS_OUTPUT statement is allowed in a Trigger . Actualtests.com - The Power of Knowing 1Z0-147 QUESTION 54: What is true about stored procedures? A. A stored procedure uses the DELCLARE keyword in the procedure specification to declare formal parameters. B. A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification. C. A stored procedure must have at least one executable statement in the procedure body. D. A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters. Answer: C Explanation: The executable section must contain at least one executable statement. You can include...
View Full Document

Ask a homework question - tutors are online