Creating and Editing Packages

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to Creating and Editing SQL Procedures

A package is a group of procedures, functions, variables, and SQL statements, used to store together related objects. Packages contain all the information needed to process SQL statements from a single source file. You can use packages to process and call batches of SQL. They are not associated with a particular table; they are stored in the database.

The following database platforms support packages:

  • Oracle 7.x, 8.x, 9i, 10g, 11g and 12c

Create a Package

  1. In the Data Model Explorer, expand the Logical Main Model, right-click the Packages node, and then click New Package.
  2. Complete the Package Editor and then click OK to create the package.

Magic Wand Icon.pngTip:

  • Once you have created the auxiliary table, you can edit it by right-clicking the package you want to change, and then clicking Edit Package.
  • The Package Editor includes find and replace functionality for working with SQL text strings.

The following helps you complete the options of the Package Editor:

Header tab

The header contains the package specification. Here you can declare types, variables, constants, exceptions, cursors and subprograms. The header does not contain any code. You can specify a package that contains only global variables that will be used by subprograms or cursors. This type of package declares only types, constants, variables, exceptions, and call specifications and does not require a package body.

Body tab

The package body provides the implementation for the subprograms and the queries for the cursors declared in the header.

Definition tab

Enter or edit a definition for the package. If the target database supports it, ER/Studio Data Architect adds this definition as a comment when generating SQL code.

Attachment Bindings tab

Bind an external piece of information, or attachment to the package. You can also remove an attachment from an object, override an attachment binding's default value, or change the position of a bound attachment. To override the value of the attachment you have moved to the Selected Attachments grid, double-click the Value field of the target attachment. ER/Studio Data Architect opens the Value Override Editor or a list depending on the attachment datatype. Attachments are created in the Attachments folder of the Data Dictionary. For more information, see Attaching External Documents to the Data Model.

Permissions tab

Sets access roles and user permissions for the package. Keep in mind that the more specific permissions are, the more time you may have to spend maintaining and updating them. The Roles and Users must be previously assigned to appear in the Package Editor. For more information, see Creating and Editing Database Roles and Creating and Editing Database Users.

See Also