Which two describe a stored procedure? (Choose two)
-
a) A stored procedure is typically written in SQL.
-
b) A stored procedure is a named PL/SQL block that can accept parameters.
-
c) A stored procedure is a type of PL/SQL subprogram that performs an action.
-
d) A stored procedure has three parts: the specification, the body, and the exception handler part.
-
e) The executable section of a stored procedure contains statements that assigns values, control execution, and return values to the calling environment.
A stored procedure is indeed a named PL/SQL block that accepts parameters (B) and is a type of PL/SQL subprogram that performs an action (C). Option A is incorrect because stored procedures are written in PL/SQL, not SQL alone. Option D is wrong because procedures have declaration, executable, and exception sections, not 'specification, body, and exception handler'. Option E incorrectly describes the executable section.
To answer this question, you need to understand what a stored procedure is. Let's go through each option to understand why it is correct or incorrect:
Option A) A stored procedure is typically written in SQL - This option is incorrect because a stored procedure can be written in various programming languages, not just SQL.
Option B) A stored procedure is a named PL/SQL block that can accept parameters - This option is correct. A stored procedure is a named block of code that can be executed in a database. It can accept parameters, which allows for flexibility and reusability.
Option C) A stored procedure is a type of PL/SQL subprogram that performs an action - This option is correct. A stored procedure is a type of subprogram in a database that performs a specific action or set of actions.
Option D) A stored procedure has three parts: the specification, the body, and the exception handler part - This option is incorrect. While a stored procedure can have multiple parts, such as a specification, body, and exception handler, it is not limited to just these three parts.
Option E) The executable section of a stored procedure contains statements that assigns values, control execution, and return values to the calling environment - This option is incorrect. While the executable section of a stored procedure can contain statements that assign values, control execution, and return values, it is not the only section of a stored procedure.
The correct answers are B) A stored procedure is a named PL/SQL block that can accept parameters and C) A stored procedure is a type of PL/SQL subprogram that performs an action. These options accurately describe the characteristics of a stored procedure.