Oracle Database SQL Language Quick Reference

Transcription

[1]Oracle DatabaseSQL Language Quick Reference11g Release 2 (11.2)E41085-04January 2016

Oracle Database SQL Language Quick Reference, 11g Release 2 (11.2)E41085-04Copyright 2003, 2016, Oracle and/or its affiliates. All rights reserved.Primary Authors:Diana Lorentz, Mary Beth Roeser, Simon WattThis software and related documentation are provided under a license agreement containing restrictions onuse and disclosure and are protected by intellectual property laws. Except as expressly permitted in yourlicense agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverseengineering, disassembly, or decompilation of this software, unless required by law for interoperability, isprohibited.The information contained herein is subject to change without notice and is not warranted to be error-free. Ifyou find any errors, please report them to us in writing.If this is software or related documentation that is delivered to the U.S. Government or anyone licensing iton behalf of the U.S. Government, then the following notice is applicable:U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,any programs installed on the hardware, and/or documentation, delivered to U.S. Government end usersare "commercial computer software" pursuant to the applicable Federal Acquisition Regulation andagency-specific supplemental regulations. As such, use, duplication, disclosure, modification, andadaptation of the programs, including any operating system, integrated software, any programs installed onthe hardware, and/or documentation, shall be subject to license terms and license restrictions applicable tothe programs. No other rights are granted to the U.S. Government.This software or hardware is developed for general use in a variety of information managementapplications. It is not developed or intended for use in any inherently dangerous applications, includingapplications that may create a risk of personal injury. If you use this software or hardware in dangerousapplications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and othermeasures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damagescaused by use of this software or hardware in dangerous applications.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks oftheir respective owners.Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarksare used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of AdvancedMicro Devices. UNIX is a registered trademark of The Open Group.This software or hardware and documentation may provide access to or information about content,products, and services from third parties. Oracle Corporation and its affiliates are not responsible for andexpressly disclaim all warranties of any kind with respect to third-party content, products, and servicesunless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and itsaffiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use ofthird-party content, products, or services, except as set forth in an applicable agreement between you andOracle.

ContentsPreface . vAudience.Documentation Accessibility .Related Documents .Conventions .1vvvviSQL StatementsSyntax for SQL Statements. 1-12SQL FunctionsSyntax for SQL Functions. 2-13SQL ExpressionsSyntax for SQL Expression Types. 3-14SQL ConditionsSyntax for SQL Condition Types . 4-15SubclausesSyntax for Subclauses. 5-16Data TypesOverview of Data Types .Oracle Built-In Data Types.Oracle-Supplied Data Types.Converting to Oracle Data Types.76-16-26-56-5Format ModelsOverview of Format Models .Number Format Models.Number Format Elements .Datetime Format Models .Datetime Format Elements .7-17-17-17-37-3iii

ASQL*Plus CommandsSQL*Plus Commands . A-1Indexiv

PrefaceThis reference contains a complete description of the Structured Query Language(SQL) used to manage information in an Oracle Database. Oracle SQL is a superset ofthe American National Standards Institute (ANSI) and the International Organizationfor Standardization (ISO) SQL:1999 standard.This Preface contains these topics: Audience Documentation Accessibility Related Documents ConventionsAudienceThe Oracle Database SQL Language Quick Reference is intended for all users of OracleSQL.Documentation AccessibilityFor information about Oracle's commitment to accessibility, visit the OracleAccessibility Program website athttp://www.oracle.com/pls/topic/lookup?ctx acc&id docacc.Access to Oracle SupportOracle customers that have purchased support have access to electronic supportthrough My Oracle Support. For information, visithttp://www.oracle.com/pls/topic/lookup?ctx acc&id info or visithttp://www.oracle.com/pls/topic/lookup?ctx acc&id trs if you are hearingimpaired.Related DocumentsFor more information, see these Oracle resources: Oracle Database PL/SQL Language Reference for information on PL/SQL, theprocedural language extension to Oracle SQLPro*C/C Programmer's Guide, Oracle SQL*Module for Ada Programmer's Guide, andthe Pro*COBOL Programmer's Guide for detailed descriptions of Oracle embeddedSQLv

Many of the examples in this book use the sample schemas, which are installed bydefault when you select the Basic Installation option with an Oracle Databaseinstallation. Refer to Oracle Database Sample Schemas for information on how theseschemas were created and how you can use them yourself.ConventionsThe following text conventions are used in this document:viConventionMeaningboldfaceBoldface type indicates graphical user interface elements associatedwith an action, or terms defined in text or the glossary.italicItalic type indicates book titles, emphasis, or placeholder variables forwhich you supply particular values.monospaceMonospace type indicates commands within a paragraph, URLs, codein examples, text that appears on the screen, or text that you enter.

11SQL StatementsThis chapter presents the syntax for Oracle SQL statements.This chapter includes the following section: Syntax for SQL StatementsSyntax for SQL StatementsSQL statements are the means by which programs and users access data in an Oracledatabase.The sections that follow show each SQL statement and its related syntax. Refer toChapter 5, "Subclauses" for the syntax of the subclauses listed in the syntax for thestatements.See Also: Oracle Database SQL Language Reference for detailedinformation about Oracle SQLALTER CLUSTERALTER CLUSTER [ schema. ]cluster{ physical attributes clause SIZE size clause allocate extent clause deallocate unused clause { CACHE NOCACHE }} .[ parallel clause ] ;ALTER DATABASEALTER DATABASE [ database ]{ startup clauses recovery clauses database file clauses logfile clauses controlfile clauses standby database clauses default settings clauses instance clauses security clause} ;ALTER DATABASE LINKALTER DATABASE LINK dblink{ CONNECT TO user IDENTIFIED BY password [ dblink authentication ] dblink authentication};SQL Statements1-1

Syntax for SQL StatementsALTER DIMENSIONALTER DIMENSION [ schema. ] dimension{ ADD { level clause hierarchy clause attribute clause extended attribute clause}} . { DROP { LEVEL level [ RESTRICT CASCADE ] HIERARCHY hierarchy ATTRIBUTE attribute [ LEVEL level [ COLUMN column ] ].}} . COMPILE;ALTER DISKGROUPALTER DISKGROUP{ diskgroup name{ { { add disk clause drop disk clause }[, { add disk clause drop disk clause } ]. resize disk clause} [ rebalance diskgroup clause ] disk online clause disk offline clause rebalance diskgroup clause check diskgroup clause diskgroup template clauses diskgroup directory clauses diskgroup alias clauses diskgroup volume clauses diskgroup attributes modify diskgroup file drop diskgroup file clause usergroup clauses user clauses file permissions clause file owner clause} { diskgroup name [, diskgroup name ] . ALL} { undrop disk clause diskgroup availability enable disable volume}} ;ALTER FLASHBACK ARCHIVEALTER FLASHBACK ARCHIVE flashback archive{ SET DEFAULT { ADD MODIFY } TABLESPACE tablespace [flashback archive quota] REMOVE TABLESPACE tablespace name MODIFY RETENTION flashback archive retention PURGE { ALL BEFORE { SCN expr TIMESTAMP expr } } [NO] OPTIMIZE DATA};Note: You can specify the [NO] OPTIMIZE DATA clause in thisstatement starting with Oracle Database 11g Release 2 (11.2.0.4).1-2 Oracle Database SQL Language Quick Reference

Syntax for SQL StatementsALTER FUNCTIONALTER FUNCTION [ schema. ] function function compile clauseALTER INDEXALTER INDEX [ schema. ]index{ { deallocate unused clause allocate extent clause shrink clause parallel clause physical attributes clause logging clause} . rebuild clause PARAMETERS ( 'ODCI parameters' )) COMPILE { ENABLE DISABLE } UNUSABLE VISIBLE INVISIBLE RENAME TO new name COALESCE { MONITORING NOMONITORING } USAGE UPDATE BLOCK REFERENCES alter index partitioning};ALTER INDEXTYPEALTER INDEXTYPE [ schema. ] indextype{ { ADD DROP } [ schema. ] operator ( parameter types )[ , { ADD DROP } [schema. ] operator ( parameter types ) ]. [ using type clause ] COMPILE}[ WITH LOCAL [ RANGE ] PARTITION ] [ storage table clause ];ALTER JAVAALTER JAVA{ SOURCE CLASS } [ schema. ]object name[ RESOLVER( ( match string [, ] { schema name - } ). )]{ { COMPILE RESOLVE } invoker rights clause} ;ALTER LIBRARYALTER LIBRARY [ schema. ] library name library compile clauseALTER MATERIALIZED VIEWALTER MATERIALIZED VIEW[ schema. ] materialized view[ physical attributes clause modify mv column clause table compression LOB storage clause [, LOB storage clause ]. modify LOB storage clause [, modify LOB storage clause ]. alter table partitioning parallel clause logging clause allocate extent clause deallocate unused clauseSQL Statements1-3

Syntax for SQL Statements ][[[ ][ ]shrink clause{ CACHE NOCACHE }alter iot clauses ]USING INDEX physical attributes clause ]MODIFY scoped table ref constraintalter mv refresh{ ENABLE DISABLE } QUERY REWRITECOMPILECONSIDER FRESH;ALTER MATERIALIZED VIEW LOGALTER MATERIALIZED VIEW LOG [ FORCE ]ON [ schema. ]table[ physical attributes clause add mv log column clause alter table partitioning parallel clause logging clause allocate extent clause shrink clause move mv log clause { CACHE NOCACHE }] [ mv log augmentation ] [ mv log purge clause ];ALTER OPERATORALTER OPERATOR [ schema. ] operator{ add binding clause drop binding clause COMPILE} ;ALTER OUTLINEALTER OUTLINE [ PUBLIC PRIVATE ] outline{ REBUILD RENAME TO new outline name CHANGE CATEGORY TO new category name { ENABLE DISABLE }} .;ALTER PACKAGEALTER PACKAGE [ schema. ] package package compile clauseALTER PROCEDUREALTER PROCEDURE [ schema. ] procedure procedure compile clauseALTER PROFILEALTER PROFILE profile LIMIT{ resource parameters password parameters } .;ALTER RESOURCE COSTALTER{ { RESOURCE COSTCPU PER SESSIONCONNECT TIMELOGICAL READS PER SESSIONPRIVATE SGA1-4 Oracle Database SQL Language Quick Reference

Syntax for SQL Statements} integer} .;ALTER ROLEALTER ROLE role{ NOT IDENTIFIED IDENTIFIED{ BY password USING [ schema. ] package EXTERNALLY GLOBALLY}} ;ALTER ROLLBACK SEGMENTALTER ROLLBACK SEGMENT rollback segment{ ONLINE OFFLINE storage clause SHRINK [ TO size clause ]};ALTER SEQUENCEALTER SEQUENCE [ schema. ] sequence{ INCREMENT BY integer { MAXVALUE integer NOMAXVALUE } { MINVALUE integer NOMINVALUE } { CYCLE NOCYCLE } { CACHE integer NOCACHE } { ORDER NOORDER }} .;ALTER SESSIONALTER SESSION{ ADVISE { COMMIT ROLLBACK NOTHING } CLOSE DATABASE LINK dblink { ENABLE DISABLE } COMMIT IN PROCEDURE { ENABLE DISABLE } GUARD { ENABLE DISABLE FORCE } PARALLEL{ DML DDL QUERY } [ PARALLEL integer ] { ENABLE RESUMABLE [ TIMEOUT integer ] [ NAME string ] DISABLE RESUMABLE} SYNC WITH PRIMARY alter session set clause} ;ALTER SYSTEMALTER SYSTEM{ archive log clause checkpoint clause check datafiles clause distributed recov clauses FLUSH { SHARED POOL GLOBAL CONTEXT BUFFER CACHE REDO TO target db name [ [ NO ] CONFIRM APPLY ] } end session clauses SWITCH LOGFILE { SUSPEND RESUME } quiesce clauses rolling migration clausesSQL Statements1-5

Syntax for SQL Statements security clausesshutdown dispatcher clauseREGISTERSET alter system set clause[ alter system set clause ]. RESET alter system reset clause[ alter system reset clause ].} ;ALTER TABLEALTER TABLE [ schema. ] table[ alter table properties column clauses constraint clauses alter table partitioning alter external table move table clause][ enable disable clause { ENABLE DISABLE } { TABLE LOCK ALL TRIGGERS }] .;ALTER TABLESPACEALTER TABLESPACE tablespace{ DEFAULT [ table compression ] [ storage clause ] MINIMUM EXTENT size clause RESIZE size clause COALESCE SHRINK SPACE [ KEEP size clause] RENAME TO new tablespace name { BEGIN END } BACKUP datafile tempfile clauses tablespace logging clauses tablespace group clause tablespace state clauses autoextend clause flashback mode clause tablespace retention clause} ;ALTER TRIGGERALTER TRIGGER [ schema. ] trigger{ ENABLE DISABLE RENAME TO new name trigger compile clause} ;ALTER TYPEALTER TYPE [ schema. ]type alter type clausesALTER USERALTER USER{ user{ IDENTIFIED{ BY password [ REPLACE old password ] EXTERNALLY [ AS 'certificate DN' AS 'kerberos principal name' ] GLOBALLY [ AS '[directory DN]' ]} DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE { tablespace tablespace group name }1-6 Oracle Database SQL Language Quick Reference

Syntax for SQL Statements { QUOTA { size clause UNLIMITED} ON tablespace} . PROFILE profile DEFAULT ROLE { role [, role ]. ALL [ EXCEPT role [, role ] . ] NONE} PASSWORD EXPIRE ACCOUNT { LOCK UNLOCK } ENABLE EDITIONS [ FORCE ]} . user [, user ]. proxy clause} ;ALTER VIEWALTER VIEW [ schema. ] view{ ADD out of line constraint MODIFY CONSTRAINT constraint{ RELY NORELY } DROP { CONSTRAINT constraint PRIMARY KEY UNIQUE (column [, column ].)} COMPILE { READ ONLY READ WRITE }} ;ANALYZEANALYZE{ { TABLE [ schema. ] table INDEX [ schema. ] index} [ partition extension clause ] CLUSTER [ schema. ] cluster}{ validation clauses LIST CHAINED ROWS [ into clause ] DELETE [ SYSTEM ] STATISTICS} ;ASSOCIATE STATISTICSASSOCIATE STATISTICS WITH{ column association function association }[ storage table clause ] ;AUDITAUDIT{ audit operation clause [ auditing by clause IN SESSION CURRENT ] audit schema object clause NETWORK} [ BY { SESSION ACCESS } ][ WHENEVER [ NOT ] SUCCESSFUL ];CALLCALL{ routine clause object access expression}[ INTO :host variable[ [ INDICATOR ] :indicator variable ] ] ;SQL Statements1-7

Syntax for SQL StatementsCOMMENTCOMMENT ON{ COLUMN [ schema. ]{ table. view. materialized view. } column EDITION edition name INDEXTYPE [ schema. ] indextype MATERIALIZED VIEW materialized view MINING MODEL [ schema. ] model OPERATOR [ schema. ] operator TABLE [ schema. ] { table view }}IS string ;COMMITCOMMIT [ WORK ][ [ COMMENT string ] [ WRITE [ WAIT NOWAIT ] [ IMMEDIATE BATCH ]] FORCE string [, integer ]] ;CREATE CLUSTERCREATE CLUSTER [ schema. ] cluster(column datatype [ SORT ][, column datatype [ SORT ] ].)[ { physical attributes clause SIZE size clause TABLESPACE tablespace { INDEX [ SINGLE TABLE ]HASHKEYS integer [ HASH IS expr ]}}.][ parallel clause ][ NOROWDEPENDENCIES ROWDEPENDENCIES ][ CACHE NOCACHE ] ;CREATE CONTEXTCREATE [ OR REPLACE ] CONTEXT namespaceUSING [ schema. ] package[ INITIALIZED { EXTERNALLY GLOBALLY } ACCESSED GLOBALLY] ;CREATE CONTROLFILECREATE CONTROLFILE[ REUSE ] [ SET ] DATABASE database[ logfile clause ]{ RESETLOGS NORESETLOGS }[ DATAFILE file specification[, file specification ]. ][ MAXLOGFILES integer MAXLOGMEMBERS integer MAXLOGHISTORY integer MAXDATAFILES integer MAXINSTANCES integer { ARCHIVELOG NOARCHIVELOG } FORCE LOGGING].[ character set clause ] ;1-8 Oracle Database SQL Language Quick Reference

Syntax for SQL StatementsCREATE DATABASECREATE DATABASE [ database ]{ USER SYS IDENTIFIED BY password USER SYSTEM IDENTIFIED BY password CONTROLFILE REUSE MAXDATAFILES integer MAXINSTANCES integer CHARACTER SET charset NATIONAL CHARACTER SET charset SET DEFAULT{ BIGFILE SMALLFILE } TABLESPACE database logging clauses tablespace clauses set time zone clause}. ;CREATE DATABASE LINKCREATE [ SHARED ] [ PUBLIC ] DATABASE LINK dblink[ CONNECT TO{ CURRENT USER user IDENTIFIED BY password [ dblink authentication ]} dblink authentication].[ USING connect string ] ;CREATE DIMENSIONCREATE DIMENSION [ schema. ] dimensionlevel clause .{ hierarchy clause attribute clause extended attribute clause}.;CREATE DIRECTORYCREATE [ OR REPLACE ] DIRECTORY directoryAS 'path name' ;CREATE DISKGROUPCREATE DISKGROUP diskgroup name[ { HIGH NORMAL EXTERNAL } REDUNDANCY ]{ [ QUORUM REGULAR ][ FAILGROUP failgroup name ]DISK qualified disk clause [, qualified disk clause].} .[ ATTRIBUTE { 'attribute name' 'attribute value' }[, 'attribute name' 'attribute value' ]. ];CREATE EDITIONCREATE EDITION edition[ AS CHILD OF parent edition ] ;CREATE FLASHBACK ARCHIVECREATE FLASHBACK ARCHIVE [DEFAULT] flashback archiveTABLESPACE tablespace[flashback archive quota][ [NO] OPTIMIZE DATA ]flashback archive retention;SQL Statements1-9

Syntax for SQL StatementsNote: You can specify the [NO] OPTIMIZE DATA clause in thisstatement starting with Oracle Database 11g Release 2 (11.2.0.4).CREATE FUNCTIONCREATE [ OR REPLACE ] FUNCTION plsql sourceCREATE INDEXCREATE [ UNIQUE BITMAP ] INDEX [ schema. ] indexON { cluster index clause table index clause bitmap join index clause}[ UNUSABLE ] ;CREATE INDEXTYPECREATE [ OR REPLACE ] INDEXTYPE [ schema. ] indextypeFOR [ schema. ] operator (paramater type [, paramater type ].)[, [ schema. ] operator (paramater type [, paramater type ].)].using type clause[WITH LOCAL [RANGE] PARTITION ][ storage table clause ];CREATE JAVACREATE [ OR REPLACE ] [ AND { RESOLVE COMPILE } ] [ NOFORCE ]JAVA { { SOURCE RESOURCE } NAMED [ schema. ] primary name CLASS [ SCHEMA schema ]}[ invoker rights clause ][ RESOLVER ( (match string [,] { schema name - }).) ]{ USING { BFILE (directory object name, server file name) { CLOB BLOB BFILE } subquery 'key for BLOB'} AS source char} ;CREATE LIBRARYCREATE [ OR REPLACE ] LIBRARY plsql sourceCREATE MATERIALIZED VIEWCREATE MATERIALIZED VIEW [ schema. ] materialized view[ OF [ schema. ] object type ][ ( { scoped table ref constraint column alias [ENCRYPT [encryption spec]]}[, { scoped table ref constraint column alias [ENCRYPT [encryption spec]]}].)]{ ON PREBUILT TABLE[ { WITH WITHOUT } REDUCED PRECISION ] physical properties materialized view props}[ USING INDEX[ physical attributes clause1-10 Oracle Database SQL Language Quick Reference

Syntax for SQL Statements TABLESPACE tablespace]. USING NO INDEX][ create mv refresh ][ FOR UPDATE ][ { DISABLE ENABLE } QUERY REWRITE ]AS subquery ;CREATE MATERIALIZED VIEW LOGCREATE MATERIALIZED VIEW LOG ON [ schema. ] table[ physical attributes clause TABLESPACE tablespace logging clause { CACHE NOCACHE }].[ parallel clause ][ table partitioning clauses ][ WITH [ { OBJECT ID PRIMARY KEY ROWID SEQUENCE COMMIT SCN}[ { , OBJECT ID , PRIMARY KEY , ROWID , SEQUENCE , COMMIT SCN}]. ](column [, column ].)[ new values clause ]] [ mv log purge clause ];CREATE OPERATORCREATE [ OR REPLACE ] OPERATOR[ schema. ] operator binding clause ;CREATE OUTLINECREATE [ OR REPLACE ][ PUBLIC PRIVATE ] OUTLINE [ outline ][ FROM [ PUBLIC PRIVATE ] source outline ][ FOR CATEGORY category ][ ON statement ] ;CREATE PACKAGECREATE [ OR REPLACE ] PACKAGE plsql sourceCREATE PACKAGE BODYCREATE [ OR REPLACE ] PACKAGE BODY plsql sourceCREATE PFILECREATE PFILE [ 'pfile name' ]FROM { SPFILE [ 'spfile name'] MEMORY} ;CREATE PROCEDURECREATE [ OR REPLACE ] PROCEDURE plsql sourceSQL Statements 1-11

Syntax for SQL StatementsCREATE PROFILECREATE PROFILE profileLIMIT { resource parameters password parameters}.;CREATE RESTORE POINTCREATE RESTORE POINT restore point[ AS OF {TIMESTAMP SCN} expr ][ PRESERVE GUARANTEE FLASHBACK DATABASE];CREATE ROLECREATE ROLE role[ NOT IDENTIFIED IDENTIFIED { BY password USING [ schema. ] package EXTERNALLY GLOBALLY}] ;CREATE ROLLBACK SEGMENTCREATE [ PUBLIC ] ROLLBACK SEGMENT rollback segment[ TABLESPACE tablespace storage clause ].];CREATE SCHEMACREATE SCHEMA AUTHORIZATION schema{ create table statement create view statement grant statement}.;CREATE SEQUENCECREATE SEQUENCE [ schema. ] sequence[ { INCREMENT BY START WITH } integer { MAXVALUE integer NOMAXVALUE } { MINVALUE integer NOMINVALUE } { CYCLE NOCYCLE } { CACHE integer NOCACHE } { ORDER NOORDER }].;CREATE SPFILECREATE SPFILE [ 'spfile name' ]FROM { PFILE [ 'pfile name' ] MEMORY} ;CREATE SYNONYMCREATE [ OR REPLACE ] [ PUBLIC ] SYNONYM[ schema. ] synonymFOR [ schema. ] object [ @ dblink ] ;CREATE TABLECREATE [ GLOBAL TEMPORARY ] TABLE [ schema. ] table1-12 Oracle Database SQL Language Quick Reference

Syntax for SQL Statements{ relational table object table XMLType table } ;CREATE TABLESPACECREATE[ BIGFILE SMALLFILE ]{ permanent tablespace clause temporary tablespace clause undo tablespace clause} ;CREATE TRIGGERCREATE [ OR REPLACE ] TRIGGER plsql sourceCREATE TYPECREATE [OR REPLACE] TYPE plsql sourceCREATE TYPE BODYCREATE [ OR REPLACE ] TYPE BODY plsql sourceCREATE USERCREATE USER userIDENTIFIED { BY password EXTERNALLY [ AS 'certificate DN' AS 'kerberos principal name' ] GLOBALLY [ AS '[ directory DN ]' ]}[ DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE{ tablespace tablespace group name } { QUOTA { size clause UNLIMITED } ON tablespace }. PROFILE profile PASSWORD EXPIRE ACCOUNT { LOCK UNLOCK }[ DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE{ tablespace tablespace group name } { QUOTA { size clause UNLIMITED } ON tablespace }. PROFILE profile PASSWORD EXPIRE ACCOUNT { LOCK UNLOCK } ENABLE EDITIONS].] ;CREATE VIEWCREATE [OR REPLACE][[NO] FORCE] [EDITIONING] VIEW [schema.] view[ ( { alias [ inline constraint. ] out of line constraint}[, { alias [ inline constraint.] out of line constraint}]) object view clause XMLType view clause]AS subquery [ subquery restriction clause ] ;DELETEDELETE [ hint ]SQL Statements 1-13

Syntax for SQL Statements[{ }FROM ]dml table expression clauseONLY (dml table expression clause)[ t alias ][ where clause ][ returning clause ][error logging clause];DISASSOCIATE STATISTICSDISASSOCIATE STATISTICS FROM{ COLUMNS [ schema. ]table.column[, [ schema. ]table.column ]. FUNCTIONS [ schema. ]function[, [ schema. ]function ]. PACKAGES [ schema. ]package[, [ schema. ]package ]. TYPES [ schema. ]type[, [ schema. ]type ]. INDEXES [ schema. ]index[, [ schema. ]index ]. INDEXTYPES [ schema. ]indextype[, [ schema. ]indextype ].}[ FORCE ] ;DROP CLUSTERDROP CLUSTER [ schema. ] cluster[ INCLUDING TABLES [ CASCADE CONSTRAINTS ] ] ;DROP CONTEXTDROP CONTEXT namespace ;DROP DATABASEDROP DATABASE ;DROP DATABASE LINKDROP [ PUBLIC ] DATABASE LINK dblink ;DROP DIMENSIONDROP DIMENSION [ schema. ] dimension ;DROP DIRECTORYDROP DIRECTORY directory name ;DROP DISKGROUPDROP DISKGROUP diskgroup name[ FORCE INCLUDING CONTENTS { INCLUDING EXCLUDING } CONTENTS];DROP EDITIONDROP EDITION edition [CASCADE];DROP FLASHBACK ARCHIVEDROP FLASHBACK ARCHIVE flashback archive;DROP FUNCTIONDROP FUNCTION [ schema. ] function name ;1-14 Oracle Database SQL Language Quick Reference

Syntax for SQL StatementsDROP INDEXDROP INDEX [ schema. ] index [ FORCE ] ;DROP INDEXTYPEDROP INDEXTYPE [ schema. ] indextype [ FORCE ] ;DROP JAVADROP JAVA { SOURCE CLASS RESOURCE }[ schema. ] object name ;DROP LIBRARYDROP LIBRARY library name ;DROP MATERIALIZED VIEWDROP MATERIALIZED VIEW [ schema. ] materialized view[ PRESERVE TABLE ] ;DROP MATERIALIZED VIEW LOGDROP MATERIALIZED VIEW LOG ON [ schema. ] table ;DROP OPERATORDROP OPERATOR [ schema. ] operator [ FORCE ] ;DROP OUTLINEDROP OUTLINE outline ;DROP PACKAGEDROP PACKAGE [ BODY ] [ schema. ] package ;DROP PROCEDUREDROP PROCEDURE [ schema. ] procedure ;DROP PROFILEDROP PROFILE profile [ CASCADE ] ;DROP RESTORE POINTDROP RESTORE POINT restore point ;DROP ROLEDROP ROLE role ;DROP ROLLBACK SEGMENTDROP ROLLBACK SEGMENT rollback segment ;DROP SEQUENCEDROP SEQUENCE [ schema. ] sequence name ;DROP SYNONYMDROP [PUBLIC] SYNONYM [ schema. ] synonym [FORCE] ;DROP TABLEDROP TABLE [ schema. ] table[ CASCADE CONSTRAINTS ] [ PURGE ] ;SQL Statements 1-15

Syntax for SQL StatementsDROP TABLESPACEDROP TABLESPACE tablespace[ INCLUDING CONTENTS [ {AND KEEP} DATAFILES ][ CASCADE CONSTRAINTS ]] ;DROP TRIGGERDROP TRIGGER [ schema. ] trigger ;DROP TYPEDROP TYPE [ schema. ] type name [ FORCE VALIDATE ] ;DROP TYPE BODYDROP TYPE BODY [ schema. ] type name ;DROP USERDROP USER user [ CASCADE ] ;DROP VIEWDROP VIEW [ schema. ] view [ CASCADE CONSTRAINTS ] ;EXPLAIN PLANEXPLAIN PLAN[ SET STATEMENT ID string ][ INTO [ schema. ] table [ @ dblink ] ]FOR statement ;FLASHBACK DATABASEFLASHBACK [ STANDBY ] DATABASE [ database ]{ TO { { SCN TIMESTAMP } expr RESTORE POINT restore point} TO BEFORE { SCN TIMESTAMP} expr RESETLOGS}} ;FLASHBACK TABLEFLASHBACK TABLE[ schema. ] table[, [ schema. ] table ].TO { { { SCN TIMESTAMP } expr RESTORE POINT restore point} [ { ENABLE DISABLE } TRIGGERS ] BEFORE DROP [ RENAME TO table ]} ;GRANTGRANT { grant system privileges grant object privileges} ;INSERTINSERT [ hint ]{ single table insert multi table insert } ;1-16 Oracle Database SQL Language Quick Reference

Syntax for SQL StatementsLOCK TABLELOCK[ ]TABLE [ schema. ] { table view }partition extension clause@ dblink[, [ schema. ] { table view }[ partition extension clause @ dblink]].IN lockmode MODE[ NOWAIT WAIT integer] ;MERGEMERGE [ hint ]INTO [ schema. ] { table view } [ t alias ]USING { [ schema. ] { table view } subquery} [ t alias ]ON ( condition )[ merge update clause ][ merge insert clause ][ error logging clause ] ;NOAUDITNOAUDIT{ audit operation clause [ auditing by clause ] audit schema object clause NETWORK}[ WHENEVER [ NOT ] SUCCESSFUL ] ;PURGEPURGE { }{ TABLE table INDEX index }{ RECYCLEBIN DBA RECYCLEBIN }TABLESPACE tablespace [ USER username ];RENAMERENAME old name TO new name ;REVOKEREVOKE { revoke system privileges revoke object privileges} ;ROLLBACKROLLBACK [ WORK ][ TO [ SAVEPOINT ] savepoint FORCE string] ;SAVEPOINTSAVEPOINT savepoint ;SELECTsubquery [ for update clause ] ;SQL Statements 1-17

Syntax for SQL StatementsSET CONSTRAINT[S]SET {{ }{CONSTRAINT CONSTRAINTS }constraint [, constraint ].ALLIMMEDIATE DEFERRED } ;SET ROLESET ROLE{ role [ IDENTIFIED BY password ][, role [ IDENTIFIED BY password ] ]. ALL [ EXCEPT role [, role ]. ] NONE} ;SET TRANSACTIONSET TRANSACTION{ { READ { ONLY WRITE } ISOLATION LEVEL{ SERIALIZABLE READ COMMITTED } USE ROLLBACK SEGMENT ro

This reference contains a complete description of the Structured Query Language (SQL) used to manage information in an Oracle Database. Oracle SQL is a superset of the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO) SQL:19