CREATE LIBRARY

Purpose

Use the CREATELIBRARY statement to create a schema object associated with an operating-system shared library. The name of this schema object can then be used in the call_spec of CREATEFUNCTION or CREATEPROCEDURE statements, or when declaring a function or procedure in a package or type, so that SQL and PL/SQL can call to third-generation-language (3GL) functions and procedures.

The CREATELIBRARY statement is valid only on platforms that support shared libraries and dynamic linking.

To create a library in your own schema, you must have the CREATELIBRARY system privilege. To create a library in another user's schema, you must have the CREATEANYLIBRARY system privilege.

To use the library in the call_spec of a CREATEFUNCTION statement, or when declaring a function in a package or type, you must have the EXECUTE object privilege on the library and the CREATEFUNCTION system privilege. Refer to Oracle Database PL/SQL Language Reference for information on the call_spec of a CREATEFUNCTION statement.

To use the library in the call_spec of a CREATEPROCEDURE statement, or when declaring a procedure in a package or type, you must have the EXECUTE object privilege on the library and the CREATEPROCEDURE system privilege. Refer to Oracle Database PL/SQL Language Reference for information on the call_spec of a CREATEPROCEDURE statement.

To execute a procedure or function defined with the call_spec (including a procedure or function defined within a package or type), you must have the EXECUTE object privilege on the procedure or function (but you do not need the EXECUTE object privilege on the library).

Syntax

Libraries are defined using PL/SQL. Therefore, the syntax diagram in this book shows only the SQL keywords. Refer to Oracle Database PL/SQL Language Reference for the PL/SQL syntax, semantics, and examples.

Specify ORREPLACE to re-create the library if it already exists. Use this clause to change the definition of an existing library without dropping, re-creating, and regranting object privileges granted on it.

Users who had previously been granted privileges on a redefined library can still access the library without being regranted the privileges.