FirebirdSQL logo
 EXTERNAL FUNCTIONPACKAGE BODY 

Examples of CREATE OR ALTER PACKAGE

Creating a new or modifying an existing package header
CREATE OR ALTER PACKAGE APP_VAR
AS
BEGIN
  FUNCTION GET_DATEBEGIN() RETURNS DATE DETERMINISTIC;
  FUNCTION GET_DATEEND() RETURNS DATE DETERMINISTIC;
  PROCEDURE SET_DATERANGE(ADATEBEGIN DATE,
      ADATEEND DATE DEFAULT CURRENT_DATE);
END

DROP PACKAGE

Drops a package header

Available in

DSQL

Syntax
DROP PACKAGE package_name
Table 1. DROP PACKAGE Statement Parameters
Parameter Description

package_name

Package name

The DROP PACKAGE statement deletes an existing package header.If a package body exists, it will be dropped together with the package header.If there are still dependencies on the package, an error will be raised.

docnext count = 4

Who Can Drop a Package

The DROP PACKAGE statement can be executed by:

  • Administrators

  • The owner of the package

  • Users with the DROP ANY PACKAGE privilege

Examples of DROP PACKAGE

Dropping a package header
DROP PACKAGE APP_VAR

RECREATE PACKAGE

Drops a package header if it exists, and creates a package header

Available in

DSQL

Syntax
RECREATE PACKAGE package_name
[SQL SECURITY {INVOKER | DEFINER}]
AS
BEGIN
  [ <package_item> ... ]
END

!! See syntax of CREATE PACKAGE for further rules!!

The RECREATE PACKAGE statement creates a new package or recreates an existing package header.If a package header with the same name already exists, then this statement will first drop it and then create a new package header.It is not possible to recreate the package header if there are still dependencies on the existing package, or if the body of the package exists.Existing privileges of the package itself are not preserved, nor are privileges to execute the procedures or functions of the package.

Examples of RECREATE PACKAGE

Creating a new or recreating an existing package header
RECREATE PACKAGE APP_VAR
AS
BEGIN
  FUNCTION GET_DATEBEGIN() RETURNS DATE DETERMINISTIC;
  FUNCTION GET_DATEEND() RETURNS DATE DETERMINISTIC;
  PROCEDURE SET_DATERANGE(ADATEBEGIN DATE,
      ADATEEND DATE DEFAULT CURRENT_DATE);
END