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

A stored procedure must have at least one executable statement in its body - it cannot be empty (just NULL is executable). Option A is wrong because it's DECLARE (not DELCLARE) and DECLARE is used in the body for local variables, not formal parameters. Option B is wrong because procedures don't require parameters - parameterless procedures are valid. Option D is wrong because DECLARE is for local variables in the body, not formal parameters in the specification.

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 DELCLARE keyword in the procedure specification to declare formal parameters. This option is incorrect. A stored procedure in PL/SQL uses the DECLARE keyword to declare local variables, not formal parameters.

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 parameter declarations in the procedure specification, it is not a requirement for a stored procedure to have at least one parameter.

Option C) A stored procedure must have at least one executable statement in the procedure body. This option is correct. In PL/SQL, a stored procedure must have at least one executable statement in its procedure body. This means that the procedure must contain code that performs an action or manipulates data.

Option D) A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters. This option is incorrect. As mentioned earlier, a stored procedure uses the DECLARE keyword to declare local variables, not formal parameters.

The correct answer is C. This option is correct because a stored procedure must have at least one executable statement in its procedure body.