nerdexam
Oracle

1Z0-052 · Question #81

Which two statements are true regarding a PL/SQL package body? (Choose two.)

The correct answer is A. It cannot be created without a package specification. D. It can be changed and recompiled without making the package specification invalid. A PL/SQL package body depends on a specification to exist and can be recompiled independently without affecting the spec's validity.

Managing Schema Objects

Question

Which two statements are true regarding a PL/SQL package body? (Choose two.)

Options

  • AIt cannot be created without a package specification.
  • BIt cannot invoke subprograms defined in other packages.
  • CIt can contain only the subprograms defined in the package specification.
  • DIt can be changed and recompiled without making the package specification invalid.

How the community answered

(57 responses)
  • A
    91% (52)
  • B
    2% (1)
  • C
    7% (4)

Why each option

A PL/SQL package body depends on a specification to exist and can be recompiled independently without affecting the spec's validity.

AIt cannot be created without a package specification.Correct

A package body cannot exist without a corresponding package specification because the spec defines the public interface that the body is required to implement. Oracle enforces this dependency at creation time.

BIt cannot invoke subprograms defined in other packages.

This is false - a package body can freely call subprograms defined in other packages, which is one of the primary purposes of the package construct in PL/SQL.

CIt can contain only the subprograms defined in the package specification.

This is false - a package body can also contain private subprograms that are not declared in the specification, making them accessible only within the body itself.

DIt can be changed and recompiled without making the package specification invalid.Correct

The package body can be modified and recompiled without invalidating the package specification, because the spec is a separate, independently compiled object. Dependent objects only become invalid when the specification itself changes.

Concept tested: PL/SQL package body structure and recompilation rules

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/CREATE-PACKAGE-BODY-statement.html

Topics

#PL/SQL packages#package body#package specification#recompilation

Community Discussion

No community discussion yet for this question.

Full 1Z0-052 Practice