What Oracle's packages should not overlook

Source: Internet
Author: User

1. Packages are equivalent to classes in Java

2. The high efficiency of the package is due to the fact that when the program first invokes the in-package function or procedure, Oracle calls the entire package into memory, and when the elements inside the package are accessed again, Oracle reads directly from memory without requiring disk I/O operations, thereby improving program execution efficiency.

3. The package is made up of two parts

(1). Package description (Specification): The package Description section declares elements of data types, variables, constants, cursors, subroutines, and exception error handling in the package, which are the public elements of the package. Specification

(2). Package Body: The package body is the specific implementation of the package Definition section, which defines the cursors and subroutines declared in the package Definition section, and the private elements of the package can also be declared in the package body.

The package description is compiled separately from the package body and is stored in the database dictionary as a two-part object, which can be viewed in the data dictionary user_source, All_source, Dba_source, respectively, for details about the package description and the package body.

4. The package name is unique, but the public components in different packages can be the same, distinguished by the package name. Public component name.

5. When creating the package body, the following points need to be noted:

The package body can only be created or compiled after the package description has been created or compiled.

The names of procedures, functions, and cursors that are implemented in the package body must conform to the procedures, functions, and cursors in the package description, including the name, the name of the parameter, and the schema of the parameter (in, out, and out). And the construction in the package description in the order to define the specific implementation of the package body.

The data types, variables, constants declared in the package body are private and can only be used in the package body and cannot be accessed and used by applications outside the printed body.

In the Package Body Execution section, you can initialize or otherwise set the package description, public or private variables declared in the package body.

6. View information about package specifications and package principals in a data dictionary
Select Object_name,object_type,status from User_objects
where lower (object_name) = ' Pkg_staff '

Reference article: http://www.cnblogs.com/huyong/archive/2011/05/26/2057973.html

What Oracle's packages should not overlook

Related Article

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.