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

Database Objects

The USE_CONCAT hint forces combined OR conditions in the WHERE clause of a query to be transformed into a compound query using the UNION ALL set operator. Generally, this transformation occurs only if the cost of the query using the concatenations is cheaper than the cost without them.

The USE_CONCAT hint turns off IN-list processing and OR-expands all disjunctions, including IN-lists.

use_hash_hint::=

/*+

USE_HASH

(

table

)

*/

The USE_HASH hint causes Oracle to join each specified table with another row source, using a hash join.

use_merge_hint::=

/*+

USE_MERGE

(

table

)

*/

The USE_MERGE hint causes Oracle to join each specified table with another row source, using a sort-merge join.

use_nl_hint::=

/*+

USE_NL

(

table

)

*/

The USE_NL hint causes Oracle to join each specified table to another row source with a nested loops join, using the specified table as the inner table.

Database Objects

Oracle recognizes objects that are associated with a particular schema and objects that are not associated with a particular schema, as described in the sections that follow.

Schema Objects

A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. Schema objects can be created and manipulated with SQL and include the following types of objects:

2-106 Oracle9i SQL Reference

Database Objects

Clusters

Constraints

Database links

Database triggers

Dimensions

External procedure libraries

Index-organized tables

Indexes

Indextypes

Java classes, Java resources, Java sources

Materialized views

Materialized view logs

Object tables

Object types

Object views

Operators

Packages

Sequences

Stored functions, stored procedures

Synonyms

Tables

Views

Nonschema Objects

Other types of objects are also stored in the database and can be created and manipulated with SQL but are not contained in a schema:

Contexts

Directories

Parameter files (PFILEs) and server parameter files (SPFILEs)

Profiles

Roles

Rollback segments

Tablespaces

Users

In this reference, each type of object is briefly defined in Chapter 9 through Chapter 18, in the section describing the statement that creates the database object. These statements begin with the keyword CREATE. For example, for the definition of a cluster, see CREATE CLUSTER on page 13-2.

Basic Elements of Oracle SQL 2-107

Database Objects

See Also: Oracle9i Database Concepts for an overview of database objects

You must provide names for most types of database objects when you create them. These names must follow the rules listed in the following sections.

Parts of Schema Objects

Some schema objects are made up of parts that you can or must name, such as:

Columns in a table or view

Index and table partitions and subpartitions

Integrity constraints on a table

Packaged procedures, packaged stored functions, and other objects stored within a package

Partitioned Tables and Indexes

Tables and indexes can be partitioned. When partitioned, these schema objects consist of a number of parts called partitions, all of which have the same logical attributes. For example, all partitions in a table share the same column and constraint definitions, and all partitions in an index share the same index columns.

When you partition a table or index using the range method, you specify a maximum value for the partitioning key column(s) for each partition. When you partition a table or index using the list method, you specify actual values for the partitioning key column(s) for each partition. When you partition a table or index using the hash method, you instruct Oracle to distribute the rows of the table into partitions based on a system-defined hash function on the partitioning key column(s). When you partition a table or index using the composite-partitioning method, you specify ranges for the partitions, and Oracle distributes the rows in each partition into one or more hash subpartitions based on a hash function. Each subpartition of a table or index partitioned using the composite method has the same logical attributes.

Partition-Extended and Subpartition-Extended Names

Partition-extended and subpartition-extended names let you perform some partition-level and subpartition-level operations, such as deleting all rows from a partition or subpartition, on only one partition or subpartition. Without extended names, such operations would require that you specify a predicate (WHERE clause).

2-108 Oracle9i SQL Reference

Database Objects

For rangeand list-partitioned tables, trying to phrase a partition-level operation with a predicate can be cumbersome, especially when the range partitioning key uses more than one column. For hash partitions and subpartitions, using a predicate is more difficult still, because these partitions and subpartitions are based on a system-defined hash function.

Partition-extended names let you use partitions as if they were tables. An advantage of this method, which is most useful for range-partitioned tables, is that you can build partition-level access control mechanisms by granting (or revoking) privileges on these views to (or from) other users or roles.To use a partition as a table, create a view by selecting data from a single partition, and then use the view as a table.

You can specify partition-extended or subpartition-extended table names for the following DML statements:

DELETE

INSERT

LOCK TABLE

SELECT

UPDATE

Note: For application portability and ANSI syntax compliance, Oracle strongly recommends that you use views to insulate applications from this Oracle proprietary extension.

Syntax The basic syntax for using partition-extended and subpartition-extended table names is:

partition_extended_name::=

 

 

@

dblink

 

 

 

 

 

 

 

 

PARTITION

(

 

partition

)

 

schema

.

table

SUBPARTITION

 

(

subpartition

)

 

 

view

 

 

 

 

 

 

Restrictions on Extended Names Currently, the use of partition-extended and subpartition-extended table names has the following restrictions:

Basic Elements of Oracle SQL 2-109

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