Syntax for creating an Oracle package

Source: Internet
Author: User
Creating an Oracle package is one of the most common operations when we use an Oracle database. The following describes the syntax for creating an Oracle package. Package is one

Creating an Oracle package is one of the most common operations when we use an Oracle database. The following describes the syntax for creating an Oracle package. Package is one

Creating an Oracle package is one of the most common operations when we use an Oracle database. The following describes the syntax for creating an Oracle package.

A package is a container that binds processes, functions, and data structures. A package consists of two parts: external visual package specifications, including function headers, and process headers, the package body contains the declaration, execution, and exception handling of all bundled processes and functions.

The packaged PL/SQL program is very different from the one not packaged. The package data exists throughout the user's session. When the user obtains the package execution authorization, it is equivalent to obtaining permissions for all programs and data structures in the package specification. However, you cannot only authorize a function or process in the package. The package can reload processes and functions. In the package, multiple programs can be declared with the same name. during runtime, the correct program is called based on the number of parameters and data types.

To create an Oracle package, you must first create a package specification. The syntax for creating an Oracle package specification is as follows:

  • CREATE [or replace] PACKAGE package_name
  • {AS | IS}
  • Public_variable_declarations |
  • Public_type_declarations |
  • Public_exception_declarations |
  • Public_cursor_declarations |
  • Function_declarations |
  • Procedure_specifications
  • END [package_name]
  • Use the create package body statement to CREATE a package body:

  • CREATE [or replace] package body package_name
  • {AS | IS}
  • Private_variable_declarations |
  • Private_type_declarations |
  • Private_exception_declarations |
  • Private_cursor_declarations |
  • Function_declarations |
  • Procedure_specifications
  • END [package_name]
  • Private Data structures are those inside the package body and are invisible to the called program.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.