Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / SQL reference.pdf
Скачиваний:
24
Добавлен:
12.05.2015
Размер:
11.92 Mб
Скачать

14

SQL Statements: CREATE LIBRARY to CREATE SPFILE

This chapter contains the following SQL statements:

CREATE LIBRARY

CREATE MATERIALIZED VIEW

CREATE MATERIALIZED VIEW LOG

CREATE OPERATOR

CREATE OUTLINE

CREATE PACKAGE

CREATE PACKAGE BODY

CREATE PFILE

CREATE PROCEDURE

CREATE PROFILE

CREATE ROLE

CREATE ROLLBACK SEGMENT

CREATE SCHEMA

CREATE SEQUENCE

CREATE SPFILE

SQL Statements: CREATE LIBRARY to CREATE SPFILE 14-1

CREATE LIBRARY

CREATE LIBRARY

Purpose

Use the CREATE LIBRARY 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 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 to third-generation-language (3GL) functions and procedures.

See Also: CREATE FUNCTION on page 13-52 and PL/SQL User’s Guide and Reference for more information on functions and procedures

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 EXECUTE object privileges on the library.

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

Syntax

create_library::=

 

OR

REPLACE

 

 

schema

.

CREATE

 

 

LIBRARY

 

libname

IS

 

 

AGENT

agent_dblink

filename

 

 

 

;

AS

 

 

 

 

 

 

Semantics

OR REPLACE

Specify OR REPLACE 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 schema object privileges granted on it.

14-2 Oracle9i SQL Reference

CREATE LIBRARY

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

libname

Specify the name you wish to represent this library when declaring a function or procedure with a call_spec.

filename

Specify a string literal, enclosed in single quotes. 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 execute a routine from it.

AGENT Clause

Specify the AGENT clause if you want external procedures to be run from a database link other than the server. Oracle will use the database link specified by agent_ dblink to run external procedures. If you omit this clause, 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.acme.com:

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

/

SQL Statements: CREATE LIBRARY to CREATE SPFILE 14-3

CREATE LIBRARY

See Also: "Defining a Public Database Link: Example" on page 13-41 for information on creating database links

14-4 Oracle9i SQL Reference

Соседние файлы в папке Oracle selected docs