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

DROP DIRECTORY

DROP DIRECTORY

Purpose

Use the DROP DIRECTORY statement to remove a directory object from the database.

See Also: CREATE DIRECTORY on page 13-49 for information on creating a directory

Prerequisites

To drop a directory, you must have the DROP ANY DIRECTORY system privilege.

Caution: Do not drop a directory when files in the associated file system are being accessed by PL/SQL or OCI programs.

Syntax

drop_directory::=

DROP DIRECTORY directory_name ;

Semantics

directory_name

Specify the name of the directory database object to be dropped.

Oracle removes the directory object but does not delete the associated operating system directory on the server’s file system.

Example

Dropping a Directory: Example The following statement drops the directory object bfile_dir:

DROP DIRECTORY bfile_dir;

See Also: "Creating a Directory: Examples" on page 13-51

16-74 Oracle9i SQL Reference

DROP FUNCTION

DROP FUNCTION

Purpose

Use the DROP FUNCTION statement to remove a standalone stored function from the database.

Note: Do not use this statement to remove a function that is part of a package. Instead, either drop the entire package using the DROP PACKAGE statement or redefine the package without the function using the CREATE PACKAGE statement with the OR REPLACE clause.

See Also:

CREATE FUNCTION on page 13-52 for information on creating a function

ALTER FUNCTION on page 9-59 for information on modifying a function

Prerequisites

The function must be in your own schema or you must have the DROP ANY

PROCEDURE system privilege.

Syntax

drop_function::=

 

schema

.

 

DROP

FUNCTION

function_name

;

Semantics

schema

Specify the schema containing the function. If you omit schema, Oracle assumes the function is in your own schema.

SQL Statements: CREATE TYPE to DROP ROLLBACK SEGMENT 16-75

DROP FUNCTION

function_name

Specify the name of the function to be dropped.

Oracle invalidates any local objects that depend on, or call, the dropped function. If you subsequently reference one of these objects, Oracle tries to recompile the object and returns an error if you have not re-created the dropped function.

If any statistics types are associated with the function, Oracle disassociates the statistics types with the FORCE option and drops any user-defined statistics collected with the statistics type.

See Also:

Oracle9i Database Concepts for more information on how Oracle maintains dependencies among schema objects, including remote objects

ASSOCIATE STATISTICS on page 12-50 and DISASSOCIATE STATISTICS on page 16-64 for more information on statistics type associations

Example

Dropping a Function: Example The following statement drops the function SecondMax in the sample schema oe and invalidates all objects that depend upon

SecondMax:

DROP FUNCTION oe.SecondMax;

See Also: "Creating a Function: Examples" on page 13-62 for information on creating the SecondMax function

16-76 Oracle9i SQL Reference

DROP INDEX

DROP INDEX

Purpose

Use the DROP INDEX statement to remove an index or domain index from the database.

When you drop an index, Oracle invalidates all objects that depend on the underlying table, including views, packages, package bodies, functions, and procedures.

When you drop a global partitioned index, a range-partitioned index, or a hash-partitioned index, all the index partitions are also dropped. If you drop a composite-partitioned index, all the index partitions and subpartitions are also dropped.

In addition, when you drop a domain index:

Oracle invokes the appropriate routine. For information on these routines, see

Oracle9i Data Cartridge Developer’s Guide.

If any statistics are associated with the domain index, Oracle disassociates the statistics types with the FORCE clause and removes the user-defined statistics collected with the statistics type.

See Also:

CREATE INDEX on page 13-65 for information on creating an index

ALTER INDEX on page 9-62 for information on modifying an index

The domain_index_clause of CREATE INDEX on page 13-65 for more information on domain indexes

ASSOCIATE STATISTICS on page 12-50 and DISASSOCIATE STATISTICS on page 16-64 for more information on statistics type associations

Prerequisites

The index must be in your own schema or you must have the DROP ANY INDEX system privilege.

SQL Statements: CREATE TYPE to DROP ROLLBACK SEGMENT 16-77

DROP INDEX

Syntax

drop_index::=

 

schema

.

 

FORCE

DROP

INDEX

 

index

;

Semantics

schema

Specify the schema containing the index. If you omit schema, Oracle assumes the index is in your own schema.

index

Specify the name of the index to be dropped. When the index is dropped, all data blocks allocated to the index are returned to the index’s tablespace.

Restriction on Dropping Indexes You cannot drop a domain index if the index or any of its index partitions is marked IN_PROGRESS.

FORCE

FORCE applies only to domain indexes. This clause drops the domain index even if the indextype routine invocation returns an error or the index is marked IN PROGRESS. Without FORCE, you cannot drop a domain index if its indextype routine invocation returns an error or the index is marked IN PROGRESS.

Example

Dropping an Index: Example This statement drops an index named ord_ customer_ix_demo (created in "General Index Examples" on page 13-87):

DROP INDEX ord_customer_ix_demo;

16-78 Oracle9i SQL Reference

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