PL/SQL Packages
In Oracle databases, packages are objects that group related PL/SQL types, items, and subprograms into modules and thus allow you to re-use code. Packages consist of a package specification and an optional package body. The specification is the interface and the body defines cursors and subprograms.
After you connect to an Oracle database with DatabaseSpy, the existing packages are displayed in the "Packages" folder of the Online Browser. If the package contains public functions or stored procedures, they are displayed in the "Procedures" and "Functions" sub-directories, respectively.
The DatabaseSpy icons associated with Oracle packages are as follows:
Package | |
Package body | |
Procedure | |
Function |
You can create new packages by entering the respective commands in the SQL Editor window and then running them against the database, for example:
CREATE [OR REPLACE] PACKAGE package_name ...
[CREATE [OR REPLACE] PACKAGE BODY package_name ... |
For the complete PL/SQL syntax, refer to Oracle documentation.
Alternatively, you can create new packages in DatabaseSpy by generating CREATE statements from existing packages, and then running them against the database like any other scripts. To do this, right-click a package or package body in the Online Browser, and select the menu command Show in SQL Editor | CREATE. Use the same approach to generate statements that alter an existing package or drop it from the database.
Note: | The support for editing PL/SQL in DatabaseSpy is limited. PL/SQL statements must be sent to the database as an entire block, and not all PL/SQL statements may be recognized and parsed correctly by the editor. Also, there are known issues when using ADO connections. |