For example begin null end incorrect answers a local

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: a NULL keyword to fulfill the need to have at least one executable statement in this section. For example, BEGIN NULL; END Incorrect Answers A. Local variables are declared after the IS or AS keyword and before the BEGIN keyword. The DECLARE keyword is not used. B. It is not required that a Procedure have a parameter. D. You do not use the DELCARE keyword when specifying parameters. The syntax for creating a procedure is: CREATE [OR REPLACE] PROCEDURE [parameter1 [mode1] datatype1, parameter2 [mode2] datatype2, . . .)] IS | AS ... BEGIN ... EXCEPTION QUESTION 55: Examine this code: CREATE OR REPLACE PROCEDURE insert_dept - The Power of Knowing 1Z0-147 (p_location_id NUMBER) IS v_dept_id NUMBER(4); BEGIN INSERT INTO departments VALUES (5, 'Education', 150, p_location_id); SELECT department_id INTO v_dept_id FROM employees WHERE employee_id=99999; END insert_dept; / CREATE OR REPLACE PROCEDURE insert_location ( p_location_id NUMBER, p_city VARCHAR2) IS BEGIN INSERT INTO locations(location_id, city) VALUES (p_location_id, p_city); insert_dept(p_location_id); END insert_location; / You just created the departments, the locations, and the employees table. You did not insert any rows. Next you created both procedures. You new invoke the insert_location procedure using the following command: EXECUTE insert_location (19, 'San Francisco') What is the result in thisEXECUTE command? A. The locations, departments, and employees tables are empty. B. The departments table has one row. The locations and the employees tables are empty. C. The location table has one row. The departments and the employees tables are empty. D. The locations table and the departments table both have one row. The employees table is empty. Answer: A Explanation: All of the tables are empty. When the following statement executed: SELECT department_id INTO v_dept_id FROM employees WHERE employee_id = 9999; An error is thrown and there is no exception section in this procedure or the calling procedure, therefore all transactions are rolled back. - The Power of Knowing 1Z0-147 Note: If the exception is not handled in the called proced...
View Full Document

This document was uploaded on 03/08/2014.

Ask a homework question - tutors are online