What are the guidelines for creating a package?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What are the guidelines for creating a package?
Rating:
Oracle recommends using the following guidelines when creating a package:
- Keep the package as general as possible so that it can be reused in future applications. Also, avoid writing a package that duplicates features provided by Oracle server.
- Define the package specification before defining the package body, as the package specification reflects the design of the application.
- The package specification should contain only those constructs that are required to be public, i.e., those constructs that must be visible to users of the package. In this way, other developers cannot misuse the package by basing their code on irrelevant details.
- Place items in the declaration part of the package body when the items are required to be maintained throughout a session or across transactions. For example, declare a variable called NUMBER_EMPLOYED as a private variable (in the declaration part of the package body) if each call to a procedure that uses the NUMBER_EMPLOYED variable needs to be maintained.
- Changes to the package body do not require recompilation of dependent constructs, whereas changes to the package specification require recompilation of every stored subprogram that references the package. Hence, in order to reduce the need for recompiling when code is changed, constructs should be placed as few as possible in a package specification.
Rating:
Was this information helpful?
Other articles
- What is the syntax for creating a procedure?
- What is a database trigger?
- How is a new job submitted to the job queue?
- What is a system event trigger?
- What is dependency failure?
