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

17

SQL Statements: DROP SEQUENCE to ROLLBACK

This chapter contains the following SQL statements:

DROP SEQUENCE

DROP SYNONYM

DROP TABLE

DROP TABLESPACE

DROP TRIGGER

DROP TYPE

DROP TYPE BODY

DROP USER

DROP VIEW

EXPLAIN PLAN

GRANT

INSERT

LOCK TABLE

MERGE

NOAUDIT

RENAME

REVOKE

ROLLBACK

SQL Statements: DROP SEQUENCE to ROLLBACK 17-1

DROP SEQUENCE

DROP SEQUENCE

Purpose

Use the DROP SEQUENCE statement to remove a sequence from the database.

You can also use this statement to restart a sequence by dropping and then recreating it. For example, if you have a sequence with a current value of 150 and you would like to restart the sequence with a value of 27, then you can drop the sequence and then re-create it with the same name and a START WITH value of 27.

See Also:

CREATE SEQUENCE on page 14-89 for information on creating a sequence

ALTER SEQUENCE on page 9-140 for more information on modifying a sequence

Prerequisites

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

Syntax

drop_sequence::=

 

schema

.

 

DROP

SEQUENCE

sequence_name

;

Semantics

schema

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

sequence_name

Specify the name of the sequence to be dropped.

17-2 Oracle9i SQL Reference

DROP SEQUENCE

Example

Dropping a Sequence: Example The following statement drops the sequence customers_seq owned by the user oe (created in "Creating a Sequence: Example" on page 14-93). To issue this statement, you must either be connected as user oe or have DROP ANY SEQUENCE system privilege:

DROP SEQUENCE oe.customers_seq;

SQL Statements: DROP SEQUENCE to ROLLBACK 17-3

DROP SYNONYM

DROP SYNONYM

Purpose

Use the DROP SYNONYM statement to remove a synonym from the database or to change the definition of a synonym by dropping and re-creating it.

See Also: CREATE SYNONYM on page 15-2 for more information on synonyms

Prerequisites

To drop a private synonym, either the synonym must be in your own schema or you must have the DROP ANY SYNONYM system privilege.

To drop a PUBLIC synonym, you must have the DROP PUBLIC SYNONYM system privilege.

Syntax

drop_synonym::=

 

PUBLIC

schema

.

FORCE

DROP

SYNONYM

 

synonym

;

Semantics

PUBLIC

You must specify PUBLIC to drop a public synonym. You cannot specify schema if you have specified PUBLIC.

schema

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

synonym

Specify the name of the synonym to be dropped.

If you drop a synonym for a materialized view, or its containing table or materialized view, or any of its dependent tables, then Oracle invalidates the materialized view.

17-4 Oracle9i SQL Reference

DROP SYNONYM

Restriction on Dropping Synonyms You cannot drop a type synonym that has any dependent tables or user-defined types unless you also specify FORCE.

FORCE

Specify FORCE to drop the synonym even if it has dependent tables or user-defined types.

Caution: Oracle does not recommend that you specify FORCE to drop object synonyms with dependencies. This operation can result in invalidation of other user-defined types or marking UNUSED the table columns that depend on the synonym. For information about type dependencies, see Oracle9i Application Developer’s Guide - Object-Relational Features.

Example

Dropping a Synonym: Example To drop the public synonym named customers (created in "Resolution of Synonyms Example" on page 15-6), issue the following statement:

DROP PUBLIC SYNONYM customers;

SQL Statements: DROP SEQUENCE to ROLLBACK 17-5

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