Skip Headers
Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)

Part Number E10472-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

CREATE LIBRARY Statement

The CREATE LIBRARY statement creates a library; that is, a schema object associated with an operating-system shared library. You can use the name of this library in the call_spec of CREATE FUNCTION or CREATE PROCEDURE statements, or when declaring a function or procedure in a package or type, so that SQL and PL/SQL can call third-generation-language (3GL) functions and procedures.

Topics:

Prerequisites

To create a library in your own schema, you must have the CREATE LIBRARY system privilege. To create a library in another user's schema, you must have the CREATE ANY LIBRARY system privilege. To use the procedures and functions stored in the library, you must have the EXECUTE object privilege on the library.

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

Syntax

create_library::=

Surrounding text describes create_library.gif.

Semantics

OR REPLACE

Re-creates the library if it exists, and recompiles it.

Users who were granted privileges on the library before it was redefined can still access the library without being regranted the privileges.

schema

The name of the schema containing the library. The default is your own schema.

library_name

The name that will represent this library when a user declares a function or procedure with a call_spec.

filename

A string literal, enclosed in single quotation marks. This string should be the path or filename your operating system recognizes as naming the shared library.

The filename is not interpreted during execution of the CREATE LIBRARY statement. The existence of the library file is not checked until an attempt is made to run a routine from it.

AGENT 'agent_dblink'

Causes external procedures to be run from a database link other than the server. Oracle Database will use the database link specified by agent_dblink to run external procedures. If you omit this clause, then the default agent on the server (extproc) will run external procedures.

Examples

Creating a Library: Examples The following statement creates library ext_lib:

CREATE LIBRARY ext_lib AS '/OR/lib/ext_lib.so';
/

The following statement re-creates library ext_lib:

CREATE OR REPLACE LIBRARY ext_lib IS '/OR/newlib/ext_lib.so';
/

Specifying an External Procedure Agent: Example The following example creates a library app_lib and specifies that external procedures will be run from the public database sales.hq.example.com:

CREATE LIBRARY app_lib as '${ORACLE_HOME}/lib/app_lib.so'
   AGENT 'sales.hq.example.com';
/

See Also:

Oracle Database SQL Language Reference for information about creating database links

Related Topics