Oracle8i SQL Reference Release 3 (8.1.7) Part Number A85397-01 |
|
This chapter describes the various types of Oracle SQL statements, and provides guidelines for finding the right SQL statement for your task.
This chapter contains these sections:
The tables in the following sections provide a functional summary of SQL statements and are divided into these categories:
Data definition language (DDL) statements enable you to perform these tasks:
The CREATE
, ALTER
, and DROP
commands require exclusive access to the specified object. For example, an ALTER TABLE
statement fails if another user has an open transaction on the specified table.
The GRANT
, REVOKE
, ANALYZE
, AUDIT
, and COMMENT
commands do not require exclusive access to the specified object. For example, you can analyze a table while other users are updating the table.
Oracle implicitly commits the current transaction before and after every DDL statement.
Many DDL statements may cause Oracle to recompile or reauthorize schema objects. For information on how Oracle recompiles and reauthorizes schema objects and the circumstances under which a DDL statement would cause this, see Oracle8i Concepts.
DDL statements are supported by PL/SQL with the use of the DBMS_SQL
package.
Table 6-1 lists the DDL statements.
Data manipulation language (DML) statements query and manipulate data in existing schema objects. These statements do not implicitly commit the current transaction.
Statement |
---|
|
|
|
|
|
|
|
The CALL
and EXPLAIN
PLAN
statements are supported in PL/SQL only when executed dynamically. All other DML statements are fully supported in PL/SQL.
Transaction control statements manage changes made by DML statements.
Statement |
---|
|
|
|
|
All transaction control statements except certain forms of the COMMIT
and ROLLBACK
commands are supported in PL/SQL. For information on the restrictions, see COMMITand ROLLBACK.
Session control statements dynamically manage the properties of a user session. These statements do not implicitly commit the current transaction.
PL/SQL does not support session control statements.
Statement |
---|
|
|
The single system control statement dynamically manages the properties of an Oracle instance. This statement does not implicitly commit the current transaction.
ALTER
SYSTEM
is not supported in PL/SQL.
Statement |
---|
|
Embedded SQL statements place DDL, DML, and transaction control statements within a procedural language program. Embedded SQL is supported by the Oracle precompilers and is documented in the following books:
The particular SQL statement you use to accomplish a given database task is sometimes obvious and sometimes difficult to predict. For example, you create a table with the CREATE
TABLE
statement. However, you don't enable a constraint with the ENABLE CONSTRAINT
statement, because such a statement doesn't exist. Rather, you modify the column options using the ALTER
TABLE
statement.
This section lists, by database object and task, the appropriate SQL statement to use to accomplish various database tasks. You can then refer to Chapter 7 through Chapter 11, for the syntax and semantics of each SQL statement.
Note: Your ability to use the SQL statements listed in this section depends on the version and edition of Oracle you are using, as well as the options you have installed. Be sure to read the detailed descriptions in Chapter 7 through Chapter 11, before using these statements. |
Database Object / Task | Operation | SQL Statement |
---|---|---|
application |
allowing to connect as a user |
|
application server |
allowing to connect as a user |
|
auditing |
of database events |
|
call |
limit CPU time for |
|
|
limit data blocks read |
|
checkpoint |
perform explicitly |
|
clone database |
mount |
|
cluster |
cluster key, change columns of |
prohibited |
|
extent, allocate for |
|
|
migrated or chained rows, identify |
|
|
parallelism of, change |
|
|
rename |
prohibited |
|
storage characteristics of, change |
|
|
tablespace of, change |
prohibited |
|
unused space in, release |
|
column |
add to a table or modify |
|
|
define |
|
|
drop from a table |
|
|
generate derived values automatically |
|
|
organization of, define |
|
commit operation |
prevent procedure or function from issuing |
|
compilation |
avoid run-time of |
|
constraint |
add to a table or modify |
|
|
business, enforce |
|
|
enable, disable, or drop |
|
|
specify |
|
control file |
back up |
|
|
standby, create |
|
currency symbol |
reset for session |
|
data |
frequently used, caching |
|
|
specify as temporary or permanent |
|
data dictionary |
convert from Oracle7 to Oracle8i |
|
data independence |
provide |
|
database |
character set of, change |
|
|
create script for |
|
|
database character set for, specify |
|
|
datafiles for, specify |
|
|
datafiles of, modify |
|
|
datafiles, establish number of |
|
|
downgrade to an earlier release |
|
|
global name of, change |
|
|
global name resolution, enable for the session |
|
|
instances, establish number of |
|
|
media recovery, design |
|
|
media recovery, perform ongoing |
|
|
mount |
|
|
move a subset to a different Oracle database |
|
|
national character set for, specify |
|
|
national character set of, change |
|
|
open |
|
|
parallelize recovery of |
|
|
place in read-only mode |
|
|
place in read-write mode |
|
|
place in sustained standby recovery mode |
|
|
prepare to re-create |
|
|
recover |
|
|
redo log file groups, establish number of |
|
|
redo log files for, specify |
|
|
redo log files of, create or modify |
|
|
redo log files, establish number of |
|
|
redo log, choose mode for |
|
|
upgrade to Oracle8i |
|
database character set |
specify for a database |
|
database events |
transparent logging of |
|
database link |
close |
|
database security |
enforce authorizations |
|
datafile |
automatic extension of, allow |
|
|
create |
|
|
put online |
|
|
reconstruct damaged |
|
|
reconstruct lost or damaged |
|
|
recover specified |
|
|
replace an old, for recovery |
|
|
resize |
|
|
take offline |
|
|
begin or end backup of |
|
|
number of, establish for a database |
|
|
online, update instance information on |
|
|
specify for a database |
|
dates |
format of |
See Table 2-9, "Date Format Elements". |
decimal character |
reset for session |
|
dimension |
add a level, hierarchy, or attribute to |
|
|
change the relationships of |
|
|
drop a level, hierarchy, or attribute from |
|
|
explicitly compile |
|
dispatcher processes |
multi-threaded server, manage |
|
domain index |
alter |
|
|
rebuild |
|
dump file |
limit the size of |
|
error messages |
language in which displayed, change |
|
function |
allow to or prevent from committing a transaction |
|
|
declaration of, change |
|
|
definition of, change |
|
|
recompile explicitly |
|
function-based index |
disable |
|
|
disabled, re-enable |
|
global names |
enforce resolution of |
|
hash join operations |
data blocks for, allocate |
|
|
in queries, enable or disable |
|
|
memory for, allocate |
|
index |
allow DML operations during rebuilding of |
|
|
based on a function; see "function-based index" |
|
|
based on an indextype; see "domain index" |
|
|
collect statistics during rebuilding of |
|
|
default attribute values of, change |
|
|
degree of parallelism for, change |
|
|
direct-load INSERT operations, write to a log |
|
|
extent for, allocate new |
|
|
key compression, enable |
|
|
key values, eliminate repetition of |
|
|
merge block contents of |
|
|
physical attributes of a partition of, change |
|
|
physical attributes of a subpartition of, change the |
|
|
physical attributes of, change |
|
|
re-create |
|
|
rebuild operations, write to a log |
|
|
SQL*Loader operations against, write to a log |
|
|
store bytes in reverse order |
|
|
tablespace for, specify |
|
|
tell Oracle not to use |
|
|
unused space, release |
|
|
rename |
|
index partition |
create-time attributes, change |
|
|
log direct-load INSERT operations |
|
|
log SQL*Loader operations against |
|
|
move to a different tablespace |
|
|
physical attributes of, change |
|
|
physical, logging, or storage characteristics of, change |
|
|
re-create |
|
|
remove from the database |
|
|
specify a tablespace for |
|
|
split into two partitions |
|
|
tell Oracle not to use |
|
index subpartition |
change a create-time attributes, change |
|
|
log direct-load INSERT operations |
|
|
log SQL*Loader operations against |
|
|
move to a different tablespace |
|
|
physical attributes, change |
|
|
physical, logging, or storage characteristics, change |
|
|
re-create |
|
|
tablespace for, specify |
|
|
tell Oracle not to use |
|
index-organized table |
characteristics, change |
|
indexes |
on a cluster |
|
|
on a nested table storage table |
|
|
on a partitioned table |
|
|
on an index-organized table |
|
|
on columns of a table |
|
|
on scalar typed object attributes |
|
instance |
dynamically modify |
|
|
make an index extent available to |
|
|
switch to a different |
|
instance recovery |
continue after interruption |
|
instances |
number of, establish for a database |
|
Java class |
force resolution of |
|
Java resource |
force compilation of |
|
Java source |
force compilation of |
|
licensing |
changing limits or thresholds |
|
LOB columns |
add to a table or modify |
|
location transparency |
provide |
|
materialized view |
automatic refresh, change the mode or timing of |
|
|
change from rowid-based to primary-key-based |
|
|
degree of parallelism, specify or change |
|
|
divide into partitions |
|
|
LOB storage characteristics, change |
|
|
LOB storage characteristics, specify |
|
|
log changes to |
|
|
make eligible for query rewrite |
|
|
make frequently accessed data accessible |
|
|
revalidate |
|
|
storage characteristics, change |
|
materialized view log |
automatic refresh, change the mode and timing of |
|
|
change from rowid-based to primary-key-based |
|
|
divide into partitions |
|
|
physical and storage characteristics, change |
|
|
save both old and new values |
|
|
store primary key of changed rows |
|
|
store rowid of changed rows |
|
media recovery |
avoid on startup |
|
|
from specified redo log file |
|
|
prepare for |
|
national character set |
specify for a database |
|
national language support |
change settings for the session |
|
nested table |
update in a view |
create an |
nested table columns |
indexing |
|
numbers |
format |
See Table 2-7, "Number Format Elements". |
object references. See REFs |
||
online redo log |
reinitialize |
|
outline |
assign to a different category |
|
|
recompile |
|
|
rename |
|
|
automatically create and store |
|
|
use to generate execution plans |
|
package |
avoid run-time compilation |
|
|
compile explicitly |
|
package body |
avoid run-time compilation |
|
|
recompile explicitly |
|
parallelism |
specify for a table |
|
|
specify for DML on a table |
|
parameter, initialization |
change the setting for the current session |
|
parameter, session |
set or change the setting of |
|
partition |
add to a table or modify |
|
|
default attributes, change |
|
|
logging characteristics, change |
|
|
merge with another partition |
|
|
point to data in a nonpartitioned table |
|
|
real attributes, change |
|
password |
complexity of, guarantee |
|
|
make unavailable |
|
|
number of days account will be locked after failed login attempts, specify |
|
|
number of days before reuse, limit |
|
|
number of days in grace period, specify |
|
|
number of days usable, limit |
|
|
number of times reused, limit |
|
|
special characters in, allow |
|
performance |
optimize for index access path |
|
|
optimize for nested loop joins |
|
|
specify the optimizer approach for the session |
|
procedure |
allow to or prevent from committing a transaction |
|
|
avoid run-time compilation |
|
|
recompile explicitly |
|
profile |
resource limit, add to |
|
|
resource limit, change |
|
|
resource limit, drop from |
|
recovery |
distributed, enable or disable |
|
recovery data |
discard |
|
redo log |
remove changes from |
|
|
reset sequence of |
|
|
specify mode of |
|
redo log file |
add |
|
|
automatically generates names for |
|
|
clear |
|
|
drop |
|
|
enable or disable thread |
|
|
rename |
|
|
number of, establish for a database |
|
|
archive manually or automatically |
|
|
number of, establish for a database |
|
|
specify a path for |
|
|
switch manually |
|
REFS |
validate and update |
|
role |
change authorization required |
|
rollback segment |
bring online |
|
|
reduce in size |
|
|
storage characteristics, change |
|
|
take offline |
|
rowid |
examine |
query the |
|
extended, interpreting contents |
|
schema |
change during the session |
|
schema object |
reference without referencing its location |
|
|
reference without referencing its owner |
|
|
specify another name for |
|
|
validate structure of |
|
sequence |
cached sequence values, change number of |
|
|
consecutive order of values, guarantee |
|
|
create |
|
|
determine current value of |
|
|
increment value, set |
|
|
maximum or minimum value, eliminate |
|
|
minimum or maximum value, set |
|
|
preallocate values for faster access |
|
|
restart after a predefined limit |
|
|
starting value, set |
|
server processes |
multi-threaded server, manage |
|
session |
CPU time for, limit |
|
|
data blocks read, limit |
|
|
enable or disable parallel transactions in |
|
|
inactive period duration, limit |
|
|
private SGA space for, limit |
|
|
resource costs allowed, change |
|
|
restrict to privileged users |
|
|
terminate |
|
|
total elapsed time, limit |
|
|
total resources for, limit |
|
SGA |
flush data from shared pool |
|
shared pool |
flush |
|
snapshot. See "materialized view". |
||
sort operations |
linguistic sequence, change |
|
standby database |
activate |
|
|
recover |
|
statistics |
on a schema object, collect |
|
|
on a schema object, delete |
|
|
on scalar object attributes, collect |
|
subpartition |
add to a table or modify |
|
|
default attributes, change |
|
|
logging characteristics, change |
|
|
real attributes, change |
|
system resources |
enable or disable |
|
table |
allocate space for |
|
|
characteristics, change |
|
|
column, drop from table |
|
|
degree of parallelism, change |
|
|
logging characteristics, change |
|
|
make read-only, read-write |
|
|
migrated or chained rows, identify |
|
|
organization, define |
|
|
partition, point to the contents of another table |
|
|
partitioning, specify |
|
|
rename |
|
|
unused space of, release |
|
|
heap or index organized |
|
|
include in a cluster |
|
|
replicate asynchronous, maintain |
|
|
storage characteristics of, set |
|
tablespace |
allow or disallow writing to |
|
|
datafiles, add or rename |
|
|
logging characteristics, change |
|
|
minimum extent length, change |
|
|
reconstruct damaged |
|
|
reconstruct lost or damaged |
|
|
recover specified |
|
|
specifying for a table |
|
|
storage characteristics, change |
|
|
take online or offline |
|
|
user quota on, change |
|
|
assign to a user |
|
|
space quota for a user, allocate |
|
tempfile |
allow for automatic extension of |
|
|
resize |
|
transaction |
distributed, force commit of |
|
|
distributed, force rollback of |
|
trigger |
enable or disable |
|
user |
authentication, change |
|
|
database resources limits, change |
|
|
default roles, change |
|
|
failed attempts to log in, limit |
|
|
number of sessions, limit |
|
|
password, change |
|
|
resource limits, set |
|
|
restrict access to Oracle |
|
|
tablespace quota, allocate |
|
|
tablespaces, assign |
|
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|