Multiple choice technology databases

What is true about stored procedures?

  1. A stored procedure uses the DELCLARE keyword in the procedure specification to declare formal parameters.

  2. A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification.

  3. A stored procedure must have at least one executable statement in the procedure body.

  4. A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Option A is incorrect: stored procedures use parameters in the specification, not DECLARE keyword (DECLARE is for anonymous blocks). Option B is incorrect: the semicolon issue suggests a typo, but procedures can have zero parameters. Option D is incorrect: formal parameters are declared in the specification header, not in the body with DECLARE. Option C is correct: a stored procedure body must contain at least one executable statement.

AI explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A stored procedure uses the DECLARE keyword in the procedure specification to declare formal parameters. - This option is incorrect. The DECLARE keyword is used in PL/SQL to declare local variables, not formal parameters for a stored procedure.

Option B) A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification. - This option is incorrect. While a stored procedure can have parameters, it is not necessary for it to have at least one parameter declaration.

Option C) A stored procedure must have at least one executable statement in the procedure body. - This option is correct. A stored procedure is a named PL/SQL block that contains a series of executable statements. It must have at least one executable statement in its body to perform a specific task or operation.

Option D) A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters. - This option is incorrect. The DECLARE keyword is used to declare local variables within a PL/SQL block, not formal parameters for a stored procedure.

The correct answer is Option C. This option is correct because a stored procedure must have at least one executable statement in its body to perform a specific task or operation.