0% found this document useful (0 votes)
467 views5 pages

Creating Procedures

The document contains a quiz on creating procedures in PL/SQL with 13 multiple choice questions. Some key points covered are: - Stored procedures can be invoked from PL/SQL anonymous blocks, calling applications, and other procedures. - Procedures require keywords like BEGIN and END, and nested procedures must have an END statement. - Benefits of procedures over anonymous blocks include code reuse, better security, and easier maintenance. - Procedures are generally used to perform actions, unlike anonymous blocks which can take parameters and are unnamed.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
467 views5 pages

Creating Procedures

The document contains a quiz on creating procedures in PL/SQL with 13 multiple choice questions. Some key points covered are: - Stored procedures can be invoked from PL/SQL anonymous blocks, calling applications, and other procedures. - Procedures require keywords like BEGIN and END, and nested procedures must have an END statement. - Benefits of procedures over anonymous blocks include code reuse, better security, and easier maintenance. - Procedures are generally used to perform actions, unlike anonymous blocks which can take parameters and are unnamed.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Test: Quiz: Creating Procedures 1. A stored procedure add_dept may be invoked by the following command in Application Express.

True or False? BEGIN add_dept; END; Mark for Review (1) Points True (*) False

Correct 2. When modifying procedure code, the procedure must be re-executed to val idate and store it in the database. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 8 Lesson 1. 3. A stored PL/SQL procedure can be invoked from which of the following? A PL/SQL anonymous block A calling application A SELECT statement Another PL/SQL procedure Mark for Review (1) Points A only A and B A and C A, B and D (*) B and C

Correct

4. Why will the following procedure fail? CREATE OR REPLACE PROCEDURE mainproc ... IS PROCEDURE subproc (...) IS BEGIN ... BEGIN ... subproc (...); ... END; Mark for Review (1) Points Procedure main proc must use the keyword AS not IS Procedure mainproc does not need the keyword BEGIN Procedure subproc does not need the keyword BEGIN Procedure subproc does not have an END; statement (*)

Correct 5. Which of the following are benefits of using PL/SQL subprograms rather than anonymous blocks? (Choose three.) Mark for Review (1) Points (Choose all correct answers) Better data security (*) Code reuse (*) Stored externally Easier code maintenance (*) Do not need to define exceptions

Incorrect. Refer to Section 8 Lesson 1. 6. Subprograms and anonymous blocks can be called by other applications. T rue or False? Mark for Review (1) Points

True False (*)

Correct 7. Which of the following keywords MUST be included in every PL/SQL proced ure definition? (Choose two.) Mark for Review (1) Points (Choose all correct answers) BEGIN (*) REPLACE EXCEPTION DECLARE END (*)

Correct 8. PL/SQL subprograms, unlike anonymous blocks, are compiled each time the y are executed. True or False? Mark for Review (1) Points True False (*)

Correct 9. Procedures are generally used to perform what? Mark for Review (1) Points A SELECT statement An action (*)

A return of values All of the above None of the above

Correct 10. A nested subprogram can be called from the main procedure or from the c alling environment. True or False? Mark for Review (1) Points True False (*)

Correct 11. A programmer wants to create a PL/SQL procedure named MY_PROC. What wil l happen when the following code is executed? CREATE OR REPLACE PROCEDURE my_proc IS v_empid employees.empid%TYPE; BEGIN SELECT employee_id INTO v_empid FROM employees WHERE region_id = 999; DBMS_OUTPUT.PUT_LINE('The salary is: ' || v_salary); Mark for Review (1) Points The statement will raise a NO_DATA_FOUND exception because region_id 999 does not exist. The statement will fail because the last line of code should be END emp_ proc; (*) The statement will fail because you cannot declare variables such as v_e mpid inside a procedure.

Incorrect. Refer to Section 8 Lesson 1. 12. The following are the steps involved in creating, and later modifying a nd re-creating, a PL/SQL procedure in Application Express. Which step is missing ? Type the procedure code in the SQL Commands window Click on the "Save" button and save the procedure code Retrieve the saved code from "Saved SQL" in SQL Commands

Modify the code in the SQL Commands window Execute the code to re-create the procedure Mark for Review (1) Points Enter parameters and data type Exe ute the procedure from USRE_SOURCE data dictionary view Execute the code to create the procedure (*) Invoke the procedure from an anonymous block

Correct 13. Which of the following are characteristics of anonymous PL/SQL blocks b ut not PL/SQL subprograms? (Choose three.) Mark for Review (1) Points (Choose all correct answers) Can take parameters Are stored in the database Can begin with the keyword DECLARE (*) Are unnamed (*) Are compiled every time they are executed (*)

Incorrect. Refer to Section 8 Lesson 1.

You might also like