Oracle supplies many PL/SQL packages with the Oracle server to extend database functionality and provide PL/SQL access to SQL features. You can use the supplied packages when creating your applications or for ideas in creating your own stored procedures.
How To Install Dbms Lock Package System
This manual covers the packages provided with the Oracle database server. Packages supplied with other products, such as Oracle Developer or the Oracle Application Server, are not covered.
Note that not every package or type described in this manual or elsewhere in the Oracle Database Documentation Library is installed by default. In such cases, the documentation states this and explains how to install the object. Run this query as a suitably privileged user:
This lists every Oracle-supplied package and type that is currently installed in the database. Note that it lists a number of objects not mentioned in the Oracle Database Documentation Library. This is deliberate. Some of the Oracle-supplied packages and types are intended to be used only by other Oracle-supplied components. Any package or type that is not described in the Oracle Database Documentation Library is not supported for direct customer use.
General Information: How: Oracle has four separate ways to induce a sleep into PL/SQL. They are: dbmsbackuprestore; dbmsdrs; dbmslock; userlock; Note that USERLOCK package is not part of the default Oracle installation. The package body has the codes for various methods declared in the package specification and other private declarations, which are hidden from the code outside the package. The CREATE PACKAGE BODY Statement is used for creating the package body. The following code snippet shows the package body declaration for the custsal package. The SLEEP procedure is added to the DBMSSESSION package, so it is available to all sessions with no additional grants needed and no dependency on the DBMSLOCK package. The procedure suspends the session for the specified number of seconds.
This chapter contains the following topics:
Package Overview
A package is an encapsulated collection of related program objects stored together in the database. Program objects are procedures, functions, variables, constants, cursors, and exceptions.
Packages have many advantages over standalone procedures and functions. For example, they:
Package Components
PL/SQL packages have two parts: the specification and the body, although sometimes the body is unnecessary. The specification is the interface to your application; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully defines cursors and subprograms, and so implements the specification.
Unlike subprograms, packages cannot be called, parameterized, or nested. However, the formats of a package and a subprogram are similar:
The specification holds public declarations that are visible to your application. The body holds implementation details and private declarations that are hidden from your application. You can debug, enhance, or replace a package body without changing the specification. You can change a package body without recompiling calling programs because the implementation details in the body are hidden from your application.
Using Oracle Supplied Packages
Most Oracle supplied packages are automatically installed when the database is created. Certain packages are not installed automatically. Special installation instructions for these packages are documented in the individual chapters.
To call a PL/SQL function from SQL, you must either own the function or have
EXECUTE privileges on the function. To select from a view defined with a PL/SQL function, you must have SELECT privileges on the view. No separate EXECUTE privileges are needed to select from the view. Instructions on special requirements for packages are documented in the individual chapters.
Creating New Packages
To create packages and store them permanently in an Oracle database, use the
CREATE PACKAGE and CREATE PACKAGE BODY statements. You can execute these statements interactively from SQL*Plus or Enterprise Manager.
To create a new package, do the following:
Separating the Specification and Body
The specification of a package declares the public types, variables, constants, and subprograms that are visible outside the immediate scope of the package. The body of a package defines the objects declared in the specification, as well as private objects that are not visible to applications outside the package.
Oracle stores the specification and body of a package separately in the database. Other schema objects that call or reference public program objects depend only on the package specification, not on the package body. Using this distinction, you can change the definition of a program object in the package body without causing Oracle to invalidate other schema objects that call or reference the program object. Oracle invalidates dependent schema objects only if you change the declaration of the program object in the package specification.
Creating a New Package: Example
The following example shows a package specification for a package named
EMPLOYEE_MANAGEMENT . The package contains one stored function and two stored procedures.
The body for this package defines the function and the procedures:
The function accepts all arguments for the fields in the employee table except for the employee number. A value for this field is supplied by a sequence. The function returns the sequence number generated by the call to this function.
How To Install Dbms Lock Package 2017
The procedure deletes the employee with an employee number that corresponds to the argument
emp_id . If no employee is found, then an exception is raised.
The procedure accepts two arguments.
Emp_id is a number that corresponds to an employee number. Sal_incr is the amount by which to increase the employee's salary.
Note:
If you want to try this example, then first create the sequence number emp_sequence . You can do this using the following SQL*Plus statement:Referencing Package ContentsHow To Install Dbms Lock Package In Nigeria
To reference the types, items, and subprograms declared in a package specification, use the dot notation. For example:
Summary of Oracle Supplied PL/SQL Packages and Types
Table 1-1 lists the supplied PL/SQL server packages. These packages run as the invoking user, rather than the package owner. Unless otherwise noted, the packages are callable through public synonyms of the same name.
Caution:
Table 1-1 Summary of Oracle Supplied PL/SQL Packages
How To Install Dbms Lock Package Without
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |