طراحی پورتال های سازمانی شرکت پروجان

شیرپوینت و پراجکت سرور پروجان

استقرار شیرپوینت و پراجکت سرور

مسیر سایت

کتاب Oracle Database SQL Language Reference.pdf

 

دانلود رایگان کتاب Oracle Database SQL Language Reference.pdf

January 2016

لینک دانلود کتاب Oracle Database SQL Language Reference.pdf

 

Contents

Preface ....................................................................................................................................... xxi
Audience...................................................................................................................................... xxi
Documentation Accessibility .......................................................................................................... xxi
Related Documents ...................................................................................................................... xxi
Conventions ................................................................................................................................ xxii
What's New in the SQL Language Reference?................................................................................ xxiii
Oracle Database 11g Release 2 (11.2.0.4) New Features in the SQL Language Reference................ xxiii
Oracle Database 11g Release 2 (11.2.0.2) New Features in the SQL Language Reference................ xxiii
Oracle Database 11g Release 2 (11.2.0.1) New Features in the SQL Language Reference................ xxiii
Oracle Database 11g Release 1 New Features in the SQL Language Reference................................ xxvi

 

1 Introduction to Oracle SQL
History of SQL ............................................................................................................................. 1-1
SQL Standards ............................................................................................................................ 1-1
How SQL Works .......................................................................................................................... 1-2
Common Language for All Relational Databases ............................................................................ 1-2
Using Enterprise Manager ............................................................................................................ 1-3
Lexical Conventions..................................................................................................................... 1-3
Tools Support ............................................................................................................................. 1-3

 

2 Pseudocolumns
Hierarchical Query Pseudocolumns .............................................................................................. 2-1
CONNECT_BY_ISCYCLE Pseudocolumn ........................................................................................ 2-1
CONNECT_BY_ISLEAF Pseudocolumn .......................................................................................... 2-2
LEVEL Pseudocolumn ................................................................................................................. 2-2
Sequence Pseudocolumns .......................................................................................................... 2-3
Where to Use Sequence Values .................................................................................................. 2-3
How to Use Sequence Values ..................................................................................................... 2-4
Version Query Pseudocolumns ................................................................................................... 2-5
COLUMN_VALUE Pseudocolumn ................................................................................................. 2-6

OBJECT_ID Pseudocolumn ......................................................................................................... 2-7
OBJECT_VALUE Pseudocolumn ................................................................................................... 2-8
ORA_ROWSCN Pseudocolumn .................................................................................................... 2-8
ROWID Pseudocolumn ............................................................................................................... 2-9
ROWNUM Pseudocolumn .......................................................................................................... 2-10
XMLDATA Pseudocolumn .......................................................................................................... 2-11

 

3 Basic Elements of Oracle SQL

Data Types ........................................................................................................................ 3-1
Oracle Built-in Data Types.......................................................................................................... 3-6
CHAR Data Type ....................................................................................................................... 3-9
NCHAR Data Type ..................................................................................................................... 3-9
NVARCHAR2 Data Type ............................................................................................................. 3-9
VARCHAR2 Data Type ............................................................................................................. 3-10
VARCHAR Data Type ............................................................................................................... 3-10
NUMBER Data Type ................................................................................................................ 3-10
FLOAT Data Type.................................................................................................................... 3-12
Floating-Point Numbers ........................................................................................................... 3-12
BINARY_FLOAT ...................................................................................................................... 3-13
BINARY_DOUBLE..................................................................................................................... 3-13
Numeric Precedence ............................................................................................................... 3-14
DATE Data Type ..................................................................................................................... 3-17
Using Julian Days .................................................................................................................... 3-17
TIMESTAMP Data Type ............................................................................................................ 3-18
TIMESTAMP WITH TIME ZONE Data Type ................................................................................. 3-18
TIMESTAMP WITH LOCAL TIME ZONE Data Type ...................................................................... 3-19
INTERVAL YEAR TO MONTH Data Type .................................................................................... 3-19
INTERVAL DAY TO SECOND Data Type ..................................................................................... 3-19
Datetime/Interval Arithmetic .................................................................................................... 3-20
Support for Daylight Saving Times ............................................................................................ 3-22
Datetime and Interval Examples ............................................................................................... 3-22
RAW and LONG RAW Data Types ............................................................................................. 3-23
BFILE Data Type ..................................................................................................................... 3-25
BLOB Data Type ..................................................................................................................... 3-26
CLOB Data Type ..................................................................................................................... 3-26
NCLOB Data Type .................................................................................................................. 3-26
Rowid Data Types .................................................................................................................. 3-27
ROWID Data Type .................................................................................................................. 3-27
UROWID Data Type ............................................................................................................... 3-28
ANSI, DB2, and SQL/DS Data Types ........................................................................................ 3-28
User-Defined Types ................................................................................................................ 3-29
Object Types ......................................................................................................................... 3-30
REF Data Types ..................................................................................................................... 3-30
Varrays ................................................................................................................................. 3-30
Nested Tables ....................................................................................................................... 3-31
Oracle-Supplied Types ............................................................................................................ 3-31
Any Types .............................................................................................................................. 3-31

ANYTYPE ............................................................................................................................... 3-31
ANYDATA............................................................................................................................... 3-32
ANYDATASET......................................................................................................................... 3-32
XML Types ............................................................................................................................ 3-32
XMLType ............................................................................................................................... 3-32
URI Data Types ..................................................................................................................... 3-32
URIFactory Package .............................................................................................................. 3-33
Spatial Types ........................................................................................................................ 3-34
SDO_GEOMETRY .................................................................................................................. 3-34
SDO_TOPO_GEOMETRY ........................................................................................................ 3-34
SDO_GEORASTER.................................................................................................................. 3-34
Media Types ......................................................................................................................... 3-35
Expression Filter Type............................................................................................................ 3-36
Expression ............................................................................................................................ 3-36
Data Type Comparison Rules ........................................................................................ 3-36
Numeric Values ..................................................................................................................... 3-36
Date Values .......................................................................................................................... 3-37
Character Values ................................................................................................................... 3-37
Object Values ........................................................................................................................ 3-39
Varrays and Nested Tables ..................................................................................................... 3-39
Data Type Precedence ........................................................................................................... 3-39
Data Conversion .................................................................................................................... 3-40
Implicit and Explicit Data Conversion ....................................................................................... 3-40
Implicit Data Conversion ......................................................................................................... 3-40
Implicit Data Conversion Examples........................................................................................... 3-42
Explicit Data Conversion ......................................................................................................... 3-43
Security Considerations for Data Conversion ............................................................................ 3-44
Literals ................................................................................................................................. 3-45
Text Literals .................................................................................................................. 3-45
Numeric Literals .................................................................................................................... 3-47
Integer Literals ..................................................................................................................... 3-47
NUMBER and Floating-Point Literals ........................................................................................ 3-47
Datetime Literals ................................................................................................................... 3-50
Interval Literals...................................................................................................................... 3-53
INTERVAL YEAR TO MONTH ................................................................................................... 3-53
INTERVAL DAY TO SECOND ................................................................................................... 3-54
Format Models ............................................................................................................... 3-56
Number Format Models .......................................................................................................... 3-57
Number Format Elements ....................................................................................................... 3-57
Datetime Format Models ......................................................................................................... 3-60
Datetime Format Elements ...................................................................................................... 3-60
Uppercase Letters in Date Format Elements .............................................................................. 3-61
Punctuation and Character Literals in Datetime Format Models ................................................... 3-61
Datetime Format Elements and Globalization Support ................................................................ 3-65
ISO Standard Date Format Elements ........................................................................................ 3-65
The RR Datetime Format Element ............................................................................................ 3-65
RR Datetime Format Examples................................................................................................. 3-66

Datetime Format Element Suffixes .......................................................................................... 3-66
Format Model Modifiers .......................................................................................................... 3-67
Format Model Examples.......................................................................................................... 3-68
String-to-Date Conversion Rules ............................................................................................. 3-69
XML Format Model ................................................................................................................. 3-70
Nulls .............................................................................................................................. 3-71
Nulls in SQL Functions ........................................................................................................... 3-71
Nulls with Comparison Conditions ........................................................................................... 3-72
Nulls in Conditions ................................................................................................................. 3-72
Comments ..................................................................................................................... 3-72
Comments Within SQL Statements ......................................................................................... 3-73
Comments on Schema and Nonschema Objects ...................................................................... 3-74
Hints .................................................................................................................................... 3-74
Alphabetical Listing of Hints ................................................................................................... 3-79
ALL_ROWS Hint .................................................................................................................... 3-79
APPEND Hint ........................................................................................................................ 3-80
APPEND_VALUES Hint ........................................................................................................... 3-80
CACHE Hint ........................................................................................................................... 3-81
CHANGE_DUPKEY_ERROR_INDEX Hint ................................................................................... 3-81
CLUSTER Hint ....................................................................................................................... 3-82
CURSOR_SHARING_EXACT Hint ............................................................................................. 3-82
DRIVING_SITE Hint .............................................................................................................. 3-82
DYNAMIC_SAMPLING Hint ..................................................................................................... 3-83
FACT Hint ............................................................................................................................. 3-83
FIRST_ROWS Hint ................................................................................................................. 3-83
FULL Hint ............................................................................................................................. 3-84
HASH Hint ............................................................................................................................ 3-84
IGNORE_ROW_ON_DUPKEY_INDEX Hint ................................................................................ 3-85
INDEX Hint ........................................................................................................................... 3-85
INDEX_ASC Hint ................................................................................................................... 3-86
INDEX_COMBINE Hint ........................................................................................................... 3-86
INDEX_DESC Hint ................................................................................................................. 3-87
INDEX_FFS Hint .................................................................................................................... 3-87
INDEX_JOIN Hint .................................................................................................................. 3-87
INDEX_SS Hint ..................................................................................................................... 3-88
INDEX_SS_ASC Hint ............................................................................................................. 3-88
INDEX_SS_DESC Hint ........................................................................................................... 3-89
LEADING Hint ...................................................................................................................... 3-89
MERGE Hint ......................................................................................................................... 3-89
MODEL_MIN_ANALYSIS Hint ................................................................................................. 3-90
MONITOR Hint ...................................................................................................................... 3-90
NATIVE_FULL_OUTER_JOIN Hint ........................................................................................... 3-90
NOAPPEND Hint .................................................................................................................... 3-91
NOCACHE Hint ...................................................................................................................... 3-91
NO_EXPAND Hint .................................................................................................................. 3-91
NO_FACT Hint ...................................................................................................................... 3-91
NO_INDEX Hint .................................................................................................................... 3-92

NO_INDEX_FFS Hint ............................................................................................................. 3-92
NO_INDEX_SS Hint ............................................................................................................... 3-92
NO_MERGE Hint ................................................................................................................... 3-93
NO_MONITOR Hint ............................................................................................................... 3-93
NO_NATIVE_FULL_OUTER_JOIN Hint .................................................................................... 3-93
NO_PARALLEL Hint .............................................................................................................. 3-93
NOPARALLEL Hint................................................................................................................. 3-94
NO_PARALLEL_INDEX Hint ................................................................................................... 3-94
NOPARALLEL_INDEX Hint...................................................................................................... 3-94
NO_PUSH_PRED Hint ........................................................................................................... 3-94
NO_PUSH_SUBQ Hint ........................................................................................................... 3-95
NO_PX_JOIN_FILTER Hint .................................................................................................... 3-95
NO_QUERY_TRANSFORMATION Hint ..................................................................................... 3-95
NO_RESULT_CACHE Hint ...................................................................................................... 3-95
NO_REWRITE Hint ............................................................................................................... 3-95
NOREWRITE Hint.................................................................................................................. 3-96
NO_STAR_TRANSFORMATION Hint ....................................................................................... 3-96
NO_STATEMENT_QUEUING Hint............................................................................................ 3-96
NO_UNNEST Hint ................................................................................................................. 3-96
NO_USE_HASH Hint ............................................................................................................. 3-96
NO_USE_MERGE Hint .......................................................................................................... 3-97
NO_USE_NL Hint ................................................................................................................. 3-97
NO_XML_QUERY_REWRITE Hint............................................................................................ 3-97
NO_XMLINDEX_REWRITE Hint .............................................................................................. 3-98
OPT_PARAM Hint ................................................................................................................. 3-98
ORDERED Hint ..................................................................................................................... 3-98
PARALLEL Hint ..................................................................................................................... 3-98
PARALLEL_INDEX Hint ........................................................................................................ 3-101
PQ_DISTRIBUTE Hint .......................................................................................................... 3-101
PUSH_PRED Hint ................................................................................................................ 3-104
PUSH_SUBQ Hint ................................................................................................................ 3-104
PX_JOIN_FILTER Hint ......................................................................................................... 3-104
QB_NAME Hint ................................................................................................................... 3-104
RESULT_CACHE Hint .......................................................................................................... 3-105
RETRY_ON_ROW_CHANGE Hint .......................................................................................... 3-105
REWRITE Hint .................................................................................................................... 3-106
STAR_TRANSFORMATION Hint ............................................................................................ 3-106
STATEMENT_QUEUING Hint ................................................................................................ 3-107
UNNEST Hint ...................................................................................................................... 3-107
USE_CONCAT Hint .............................................................................................................. 3-107
USE_HASH Hint .................................................................................................................. 3-108
USE_MERGE Hint ................................................................................................................ 3-108
USE_NL Hint ....................................................................................................................... 3-108
USE_NL_WITH_INDEX Hint ................................................................................................. 3-109
Database Objects ........................................................................................................ 3-109
Schema Objects .................................................................................................................. 3-109
Nonschema Objects ............................................................................................................. 3-110

Database Object Names and Qualifiers ................................................................................. 3-110
Database Object Naming Rules ............................................................................................ 3-111
Schema Object Naming Examples ........................................................................................ 3-114
Schema Object Naming Guidelines ....................................................................................... 3-115
Syntax for Schema Objects and Parts in SQL Statements........................................................ 3-115
How Oracle Database Resolves Schema Object References .................................................... 3-116
References to Objects in Other Schemas .............................................................................. 3-117
References to Objects in Remote Databases ......................................................................... 3-117
Creating Database Links ...................................................................................................... 3-117
Database Link Names .......................................................................................................... 3-117
Username and Password...................................................................................................... 3-118
Database Connect String...................................................................................................... 3-118
References to Database Links .............................................................................................. 3-118
References to Partitioned Tables and Indexes ....................................................................... 3-119
References to Object Type Attributes and Methods ................................................................ 3-121

 

4 Operators
About SQL Operators............................................................................................................... 4-1
Unary and Binary Operators .................................................................................................... 4-2
Operator Precedence .............................................................................................................. 4-2
Arithmetic Operators .............................................................................................................. 4-3
Concatenation Operator........................................................................................................... 4-4
Hierarchical Query Operators.................................................................................................... 4-5
PRIOR .................................................................................................................................... 4-5
CONNECT_BY_ROOT ............................................................................................................... 4-5
Set Operators .......................................................................................................................... 4-5
Multiset Operators ................................................................................................................... 4-6
MULTISET EXCEPT .................................................................................................................. 4-6
MULTISET INTERSECT ............................................................................................................. 4-7
MULTISET UNION .................................................................................................................... 4-8
User-Defined Operators ............................................................................................................ 4-9

 

5 Functions
About SQL Functions ............................................................................................................... 5-2
Single-Row Functions .............................................................................................................. 5-3
Numeric Functions .................................................................................................................. 5-3
Character Functions Returning Character Values ....................................................................... 5-4
Character Functions Returning Number Values .......................................................................... 5-5
Character Set Functions ........................................................................................................... 5-5
Datetime Functions ................................................................................................................. 5-5
General Comparison Functions ................................................................................................. 5-6
Conversion Functions .............................................................................................................. 5-6
Large Object Functions ........................................................................................................... 5-7
Collection Functions ................................................................................................................ 5-7
Hierarchical Functions ............................................................................................................. 5-7
Data Mining Functions ............................................................................................................. 5-7
XML Functions ........................................................................................................................ 5-8

Encoding and Decoding Functions ............................................................................................ 5-9
NULL-Related Functions .......................................................................................................... 5-9
Environment and Identifier Functions ....................................................................................... 5-9
Aggregate Functions .............................................................................................................. 5-10
Analytic Functions .................................................................................................................. 5-11
Object Reference Functions .................................................................................................... 5-17
Model Functions .................................................................................................................... 5-17
OLAP Functions ..................................................................................................................... 5-17
Data Cartridge Functions ........................................................................................................ 5-17
Alphabetical Listing of SQL Functions ...................................................................................... 5-17
ABS ...................................................................................................................................... 5-18
ACOS .................................................................................................................................... 5-19
ADD_MONTHS ...................................................................................................................... 5-20
APPENDCHILDXML ................................................................................................................ 5-21
ASCII ................................................................................................................................... 5-22
ASCIISTR ............................................................................................................................. 5-23
ASIN .................................................................................................................................... 5-24
ATAN ................................................................................................................................... 5-25
ATAN2 .................................................................................................................................. 5-26
AVG ..................................................................................................................................... 5-27
BFILENAME .......................................................................................................................... 5-29
BIN_TO_NUM ....................................................................................................................... 5-30
BITAND ................................................................................................................................ 5-32
CARDINALITY ....................................................................................................................... 5-34
CAST .................................................................................................................................... 5-35
CEIL ..................................................................................................................................... 5-38
CHARTOROWID .................................................................................................................... 5-39
CHR ..................................................................................................................................... 5-40
CLUSTER_ID ........................................................................................................................ 5-42
CLUSTER_PROBABILITY ........................................................................................................ 5-44
CLUSTER_SET ....................................................................................................................... 5-46
COALESCE ............................................................................................................................ 5-48
COLLECT .............................................................................................................................. 5-50
COMPOSE ............................................................................................................................. 5-51
CONCAT ............................................................................................................................... 5-52
CONVERT ............................................................................................................................. 5-53
CORR ................................................................................................................................... 5-55
CORR_* ................................................................................................................................ 5-57
CORR_S ................................................................................................................................ 5-58
CORR_K ................................................................................................................................ 5-59
COS ...................................................................................................................................... 5-60
COSH .................................................................................................................................... 5-61
COUNT .................................................................................................................................. 5-62
COVAR_POP .......................................................................................................................... 5-64
COVAR_SAMP ........................................................................................................................ 5-66
CUBE_TABLE ......................................................................................................................... 5-67
CUME_DIST ........................................................................................................................... 5-69

CURRENT_DATE ..................................................................................................................... 5-71
CURRENT_TIMESTAMP ........................................................................................................... 5-72
CV.......................................................................................................................................... 5-73
DATAOBJ_TO_PARTITION ....................................................................................................... 5-75
DBTIMEZONE ......................................................................................................................... 5-76
DECODE ................................................................................................................................ 5-77
DECOMPOSE .......................................................................................................................... 5-79
DELETEXML ............................................................................................................................ 5-80
DENSE_RANK ......................................................................................................................... 5-82
DEPTH ................................................................................................................................... 5-84
DEREF ................................................................................................................................... 5-85
DUMP .................................................................................................................................... 5-86
EMPTY_BLOB, EMPTY_CLOB ................................................................................................... 5-88
EXISTSNODE ......................................................................................................................... 5-89
EXP ....................................................................................................................................... 5-90
EXTRACT (datetime) ............................................................................................................... 5-91
EXTRACT (XML) ...................................................................................................................... 5-94
EXTRACTVALUE ...................................................................................................................... 5-95
FEATURE_ID ........................................................................................................................... 5-96
FEATURE_SET ......................................................................................................................... 5-97
FEATURE_VALUE ..................................................................................................................... 5-99
FIRST ................................................................................................................................... 5-101
FIRST_VALUE ........................................................................................................................ 5-103
FLOOR .................................................................................................................................. 5-105
FROM_TZ .............................................................................................................................. 5-106
GREATEST ............................................................................................................................. 5-107
GROUP_ID ............................................................................................................................. 5-109
GROUPING ............................................................................................................................ 5-110
GROUPING_ID ....................................................................................................................... 5-111
HEXTORAW ........................................................................................................................... 5-112
INITCAP ................................................................................................................................ 5-113
INSERTCHILDXML .................................................................................................................. 5-114
INSERTCHILDXMLAFTER ........................................................................................................ 5-116
INSERTCHILDXMLBEFORE ...................................................................................................... 5-117
INSERTXMLAFTER .................................................................................................................. 5-118
INSERTXMLBEFORE ............................................................................................................... 5-119
INSTR ................................................................................................................................... 5-120
ITERATION_NUMBER ............................................................................................................. 5-122
LAG ...................................................................................................................................... 5-124
LAST .................................................................................................................................... 5-126
LAST_DAY ............................................................................................................................ 5-127
LAST_VALUE ......................................................................................................................... 5-128
LEAD .................................................................................................................................... 5-131
LEAST .................................................................................................................................. 5-133
LENGTH ............................................................................................................................... 5-135
LISTAGG .............................................................................................................................. 5-136
LN ....................................................................................................................................... 5-138

LNNVL ................................................................................................................................. 5-139
LOCALTIMESTAMP ............................................................................................................... 5-140
LOG .................................................................................................................................... 5-141
LOWER ................................................................................................................................ 5-142
LPAD.................................................................................................................................... 5-143
LTRIM ................................................................................................................................. 5-144
MAKE_REF ........................................................................................................................... 5-145
MAX .................................................................................................................................... 5-146
MEDIAN .............................................................................................................................. 5-148
MIN .................................................................................................................................... 5-150
MOD ................................................................................................................................... 5-152
MONTHS_BETWEEN ............................................................................................................ 5-153
NANVL ................................................................................................................................ 5-154
NCHR ................................................................................................................................. 5-155
NEW_TIME ......................................................................................................................... 5-156
NEXT_DAY ......................................................................................................................... 5-157
NLS_CHARSET_DECL_LEN .................................................................................................. 5-158
NLS_CHARSET_ID .............................................................................................................. 5-159
NLS_CHARSET_NAME ......................................................................................................... 5-160
NLS_INITCAP ..................................................................................................................... 5-161
NLS_LOWER ....................................................................................................................... 5-162
NLS_UPPER ........................................................................................................................ 5-163
NLSSORT ........................................................................................................................... 5-164
NTH_VALUE ....................................................................................................................... 5-167
NTILE ................................................................................................................................ 5-169
NULLIF .............................................................................................................................. 5-170
NUMTODSINTERVAL .......................................................................................................... 5-171
NUMTOYMINTERVAL .......................................................................................................... 5-172
NVL .................................................................................................................................. 5-173
NVL2 ................................................................................................................................ 5-174
ORA_DST_AFFECTED ........................................................................................................ 5-175
ORA_DST_CONVERT ......................................................................................................... 5-176
ORA_DST_ERROR ............................................................................................................. 5-177
ORA_HASH ....................................................................................................................... 5-178
PATH ............................................................................................................................... 5-179
PERCENT_RANK ............................................................................................................... 5-180
PERCENTILE_CONT .......................................................................................................... 5-182
PERCENTILE_DISC ........................................................................................................... 5-185
POWER ............................................................................................................................ 5-187
POWERMULTISET ............................................................................................................. 5-188
POWERMULTISET_BY_CARDINALITY ................................................................................. 5-189
PREDICTION .................................................................................................................... 5-191
PREDICTION_BOUNDS ..................................................................................................... 5-193
PREDICTION_COST .......................................................................................................... 5-195
PREDICTION_DETAILS ..................................................................................................... 5-197
PREDICTION_PROBABILITY .............................................................................................. 5-199
PREDICTION_SET ............................................................................................................ 5-201

PRESENTNNV .................................................................................................................. 5-204
PRESENTV....................................................................................................................... 5-206
PREVIOUS ...................................................................................................................... 5-208
RANK ............................................................................................................................. 5-209
RATIO_TO_REPORT ........................................................................................................ 5-211
RAWTOHEX .................................................................................................................... 5-212
RAWTONHEX .................................................................................................................. 5-213
REF ................................................................................................................................ 5-214
REFTOHEX ...................................................................................................................... 5-215
REGEXP_COUNT ............................................................................................................. 5-216
REGEXP_INSTR .............................................................................................................. 5-218
REGEXP_REPLACE .......................................................................................................... 5-221
REGEXP_SUBSTR ........................................................................................................... 5-224
REGR_ (Linear Regression) Functions .............................................................................. 5-226
REMAINDER ................................................................................................................... 5-231
REPLACE ........................................................................................................................ 5-232
ROUND (date) ................................................................................................................ 5-233
ROUND (number) ........................................................................................................... 5-234
ROW_NUMBER ............................................................................................................... 5-236
ROWIDTOCHAR ............................................................................................................. 5-238
ROWIDTONCHAR ........................................................................................................... 5-239
RPAD ............................................................................................................................. 5-240
RTRIM ........................................................................................................................... 5-241
SCN_TO_TIMESTAMP ..................................................................................................... 5-242
SESSIONTIMEZONE ........................................................................................................ 5-244
SET ................................................................................................................................ 5-245
SIGN .............................................................................................................................. 5-246
SIN ................................................................................................................................ 5-247
SINH .............................................................................................................................. 5-248
SOUNDEX ....................................................................................................................... 5-249
SQRT ............................................................................................................................. 5-250
STATS_BINOMIAL_TEST ................................................................................................. 5-251
STATS_CROSSTAB ......................................................................................................... 5-252
STATS_F_TEST .............................................................................................................. 5-253
STATS_KS_TEST ............................................................................................................ 5-255
STATS_MODE ................................................................................................................ 5-256
STATS_MW_TEST .......................................................................................................... 5-257
STATS_ONE_WAY_ANOVA .............................................................................................. 5-259
STATS_T_TEST_* ........................................................................................................... 5-261
STATS_T_TEST_ONE ...................................................................................................... 5-263
STATS_T_TEST_PAIRED ................................................................................................. 5-264
STATS_T_TEST_INDEP and STATS_T_TEST_INDEPU ........................................................ 5-265
STATS_WSR_TEST ......................................................................................................... 5-267
STDDEV ........................................................................................................................ 5-268
STDDEV_POP ................................................................................................................. 5-270
STDDEV_SAMP ............................................................................................................... 5-272
SUBSTR ......................................................................................................................... 5-274

SUM .............................................................................................................................. 5-276
SYS_CONNECT_BY_PATH ............................................................................................... 5-278
SYS_CONTEXT .............................................................................................................. 5-279
SYS_DBURIGEN ............................................................................................................ 5-286
SYS_EXTRACT_UTC ...................................................................................................... 5-287
SYS_GUID .................................................................................................................... 5-288
SYS_TYPEID ................................................................................................................. 5-289
SYS_XMLAGG ............................................................................................................... 5-290
SYS_XMLGEN ............................................................................................................... 5-291
SYSDATE ..................................................................................................................... 5-292
SYSTIMESTAMP ........................................................................................................... 5-293
TAN ............................................................................................................................ 5-294
TANH .......................................................................................................................... 5-295
TIMESTAMP_TO_SCN ................................................................................................... 5-296
TO_BINARY_DOUBLE ................................................................................................... 5-297
TO_BINARY_FLOAT ...................................................................................................... 5-299
TO_BLOB .................................................................................................................... 5-300
TO_CHAR (character) .................................................................................................. 5-301
TO_CHAR (datetime) ................................................................................................... 5-302
TO_CHAR (number) .................................................................................................... 5-305
TO_CLOB ................................................................................................................... 5-307
TO_DATE ................................................................................................................... 5-308
TO_DSINTERVAL ........................................................................................................ 5-310
TO_LOB ..................................................................................................................... 5-312
TO_MULTI_BYTE ........................................................................................................ 5-313
TO_NCHAR (character) ................................................................................................ 5-314
TO_NCHAR (datetime) ................................................................................................. 5-315
TO_NCHAR (number) ................................................................................................... 5-316
TO_NCLOB ................................................................................................................... 5-317
TO_NUMBER ................................................................................................................ 5-318
TO_SINGLE_BYTE ......................................................................................................... 5-319
TO_TIMESTAMP ............................................................................................................ 5-320
TO_TIMESTAMP_TZ ....................................................................................................... 5-321
TO_YMINTERVAL ........................................................................................................... 5-323
TRANSLATE ................................................................................................................... 5-324
TRANSLATE ... USING ..................................................................................................... 5-325
TREAT ........................................................................................................................... 5-327
TRIM ............................................................................................................................. 5-328
TRUNC (date) ................................................................................................................. 5-329
TRUNC (number) ............................................................................................................ 5-330
TZ_OFFSET ..................................................................................................................... 5-331
UID ................................................................................................................................ 5-332
UNISTR .......................................................................................................................... 5-333
UPDATEXML ................................................................................................................... 5-334
UPPER ............................................................................................................................ 5-336
USER .............................................................................................................................. 5-337
USERENV ........................................................................................................................ 5-338

VALUE ............................................................................................................................ 5-340
VAR_POP ........................................................................................................................ 5-341
VAR_SAMP ...................................................................................................................... 5-343
VARIANCE ....................................................................................................................... 5-344
VSIZE .............................................................................................................................. 5-346
WIDTH_BUCKET .............................................................................................................. 5-347
XMLAGG .......................................................................................................................... 5-349
XMLCAST.......................................................................................................................... 5-351
XMLCDATA ....................................................................................................................... 5-352
XMLCOLATTVAL ............................................................................................................... 5-353
XMLCOMMENT ................................................................................................................ 5-354
XMLCONCAT ................................................................................................................... 5-355
XMLDIFF ........................................................................................................................ 5-356
XMLELEMENT ................................................................................................................. 5-358
XMLEXISTS ..................................................................................................................... 5-361
XMLFOREST .................................................................................................................... 5-362
XMLISVALID .................................................................................................................... 5-363
XMLPARSE ...................................................................................................................... 5-364
XMLPATCH ...................................................................................................................... 5-365
XMLPI ............................................................................................................................. 5-367
XMLQUERY ..................................................................................................................... 5-368
XMLROOT ....................................................................................................................... 5-370
XMLSEQUENCE ............................................................................................................... 5-371
XMLSERIALIZE ............................................................................................................... 5-373
XMLTABLE ..................................................................................................................... 5-375
XMLTRANSFORM ............................................................................................................ 5-377
ROUND and TRUNC Date Functions ................................................................................. 5-379
About User-Defined Functions ......................................................................................... 5-380
Prerequisites................................................................................................................... 5-381
Name Precedence .......................................................................................................... 5-382
Naming Conventions ...................................................................................................... 5-382

 

6 Expressions
About SQL Expressions ...................................................................................................... 6-1
Simple Expressions ............................................................................................................ 6-3
Compound Expressions ...................................................................................................... 6-4
CASE Expressions .............................................................................................................. 6-5
Column Expressions .......................................................................................................... 6-6
CURSOR Expressions.......................................................................................................... 6-7
Datetime Expressions ........................................................................................................ 6-8
Function Expressions ....................................................................................................... 6-10
Interval Expressions ........................................................................................................ 6-10
Model Expressions ........................................................................................................... 6-11
Object Access Expressions ............................................................................................... 6-13
Placeholder Expressions .................................................................................................. 6-14
Scalar Subquery Expressions ........................................................................................... 6-14
Type Constructor Expressions .......................................................................................... 6-14

Expression Lists .............................................................................................................. 6-16

 

7 Conditions
About SQL Conditions........................................................................................................ 7-1
Condition Precedence........................................................................................................ 7-3
Comparison Conditions ..................................................................................................... 7-4
Simple Comparison Conditions .......................................................................................... 7-5
Group Comparison Conditions ........................................................................................... 7-6
Floating-Point Conditions .................................................................................................. 7-7
Logical Conditions ............................................................................................................ 7-8
Model Conditions ............................................................................................................. 7-9
IS ANY Condition ............................................................................................................. 7-9
IS PRESENT Condition .................................................................................................... 7-10
Multiset Conditions ......................................................................................................... 7-11
IS A SET Condition ......................................................................................................... 7-12
IS EMPTY Condition ....................................................................................................... 7-12
MEMBER Condition ........................................................................................................ 7-13
SUBMULTISET Condition ................................................................................................ 7-13
Pattern-matching Conditions .......................................................................................... 7-14
LIKE Condition .............................................................................................................. 7-14
REGEXP_LIKE Condition ................................................................................................ 7-18
Null Conditions ............................................................................................................. 7-19
XML Conditions ............................................................................................................ 7-20
EQUALS_PATH Condition .............................................................................................. 7-20
UNDER_PATH Condition ............................................................................................... 7-21
Compound Conditions .................................................................................................. 7-21
BETWEEN Condition .................................................................................................... 7-22
EXISTS Condition ........................................................................................................ 7-22
IN Condition ............................................................................................................... 7-23
IS OF type Condition ................................................................................................... 7-25

 

8 Common SQL DDL Clauses
allocate_extent_clause .................................................................................................. 8-2
constraint .................................................................................................................... 8-4
deallocate_unused_clause ........................................................................................... 8-27
file_specification ......................................................................................................... 8-29
logging_clause ........................................................................................................... 8-38
parallel_clause............................................................................................................. 8-41
physical_attributes_clause ........................................................................................... 8-44
size_clause ................................................................................................................. 8-47
storage_clause ............................................................................................................ 8-48

 

9 SQL Queries and Subqueries
About Queries and Subqueries ....................................................................................... 9-1
Creating Simple Queries ................................................................................................ 9-2
Hierarchical Queries ...................................................................................................... 9-3

Hierarchical Query Examples ......................................................................................... 9-5
The UNION [ALL], INTERSECT, MINUS Operators ........................................................... 9-8
Sorting Query Results ................................................................................................. 9-10
Joins ......................................................................................................................... 9-11
Join Conditions .......................................................................................................... 9-11
Equijoins ................................................................................................................... 9-11
Self Joins .................................................................................................................. 9-12
Cartesian Products ..................................................................................................... 9-12
Inner Joins ................................................................................................................ 9-12
Outer Joins ............................................................................................................... 9-12
Antijoins ................................................................................................................... 9-14
Semijoins .................................................................................................................. 9-14
Using Subqueries ...................................................................................................... 9-14
Unnesting of Nested Subqueries ................................................................................ 9-15
Selecting from the DUAL Table .................................................................................. 9-16
Distributed Queries .................................................................................................. 9-16

 

10 SQL Statements: ALTER CLUSTER to ALTER JAVA
Types of SQL Statements ........................................................................................ 10-1
Data Definition Language (DDL) Statements ............................................................. 10-2
Data Manipulation Language (DML) Statements ........................................................ 10-2
Transaction Control Statements ............................................................................... 10-3
Session Control Statements ..................................................................................... 10-3
System Control Statement ....................................................................................... 10-3
Embedded SQL Statements ..................................................................................... 10-3
How the SQL Statement Chapters are Organized ...................................................... 10-4
ALTER CLUSTER .................................................................................................... 10-5
ALTER DATABASE .................................................................................................. 10-8
ALTER DATABASE LINK ........................................................................................ 10-46
ALTER DIMENSION .............................................................................................. 10-48
ALTER DISKGROUP .............................................................................................. 10-51
ALTER FLASHBACK ARCHIVE ................................................................................ 10-74
ALTER FUNCTION ................................................................................................ 10-77
ALTER INDEX ...................................................................................................... 10-78
ALTER INDEXTYPE ............................................................................................... 10-97
ALTER JAVA ....................................................................................................... 10-100

 

11 SQL Statements: ALTER LIBRARY to ALTER SYSTEM
ALTER LIBRARY...................................................................................................... 11-2
ALTER MATERIALIZED VIEW .................................................................................. 11-3
ALTER MATERIALIZED VIEW LOG ......................................................................... 11-18
ALTER OPERATOR ............................................................................................... 11-25
ALTER OUTLINE .................................................................................................. 11-28
ALTER PACKAGE ................................................................................................. 11-30
ALTER PROCEDURE ............................................................................................. 11-31
ALTER PROFILE ................................................................................................... 11-32
ALTER RESOURCE COST ...................................................................................... 11-35

ALTER ROLE ....................................................................................................... 11-38
ALTER ROLLBACK SEGMENT ................................................................................ 11-40
ALTER SEQUENCE ............................................................................................... 11-43
ALTER SESSION .................................................................................................. 11-45
Initialization Parameters and ALTER SESSION........................................................ 11-50
Session Parameters and ALTER SESSION .............................................................. 11-51
ALTER SYSTEM ................................................................................................... 11-58


12 SQL Statements: ALTER TABLE to ALTER TABLESPACE
ALTER TABLE ....................................................................................................... 12-2
ALTER TABLESPACE ............................................................................................ 12-90


13 SQL Statements: ALTER TRIGGER to COMMIT
ALTER TRIGGER ................................................................................................... 13-2
ALTER TYPE ......................................................................................................... 13-4
ALTER USER ......................................................................................................... 13-6
ALTER VIEW ....................................................................................................... 13-14
ANALYZE ............................................................................................................. 13-17
ASSOCIATE STATISTICS ....................................................................................... 13-25
AUDIT ................................................................................................................. 13-29
CALL ................................................................................................................... 13-42
COMMENT ........................................................................................................... 13-46
COMMIT .............................................................................................................. 13-49


14 SQL Statements: CREATE CLUSTER to CREATE JAVA
CREATE CLUSTER .................................................................................................. 14-2
CREATE CONTEXT ................................................................................................. 14-9
CREATE CONTROLFILE ......................................................................................... 14-12
CREATE DATABASE .............................................................................................. 14-19
CREATE DATABASE LINK ...................................................................................... 14-31
CREATE DIMENSION ............................................................................................ 14-36
CREATE DIRECTORY ............................................................................................ 14-41
CREATE DISKGROUP ............................................................................................ 14-43
CREATE EDITION ................................................................................................. 14-51
CREATE FLASHBACK ARCHIVE .............................................................................. 14-55
CREATE FUNCTION .............................................................................................. 14-58
CREATE INDEX ..................................................................................................... 14-60
CREATE INDEXTYPE .............................................................................................. 14-87
CREATE JAVA ........................................................................................................ 14-91

 

15 SQL Statements: CREATE LIBRARY to CREATE SPFILE

CREATE LIBRARY .................................................................................................... 15-2
CREATE MATERIALIZED VIEW ................................................................................. 15-4
CREATE MATERIALIZED VIEW LOG ........................................................................ 15-27
CREATE OPERATOR ............................................................................................... 15-35

CREATE OUTLINE .................................................................................................. 15-38
CREATE PACKAGE .................................................................................................. 15-42
CREATE PACKAGE BODY ......................................................................................... 15-44
CREATE PFILE ........................................................................................................ 15-46
CREATE PROCEDURE .............................................................................................. 15-48
CREATE PROFILE .................................................................................................... 15-50
CREATE RESTORE POINT ........................................................................................ 15-56
CREATE ROLE ......................................................................................................... 15-59
CREATE ROLLBACK SEGMENT .................................................................................. 15-62
CREATE SCHEMA ..................................................................................................... 15-65
CREATE SEQUENCE ................................................................................................. 15-67
CREATE SPFILE ....................................................................................................... 15-71

 

16 SQL Statements: CREATE SYNONYM to CREATE TRIGGER
CREATE SYNONYM .................................................................................................... 16-2
CREATE TABLE .......................................................................................................... 16-6
CREATE TABLESPACE ............................................................................................... 16-83
CREATE TRIGGER .................................................................................................... 16-98

 

17 SQL Statements: CREATE TYPE to DROP ROLLBACK SEGMENT
CREATE TYPE ........................................................................................................... 17-3
CREATE TYPE BODY .................................................................................................. 17-5
CREATE USER ........................................................................................................... 17-7
CREATE VIEW ......................................................................................................... 17-14
DELETE .................................................................................................................. 17-26
DISASSOCIATE STATISTICS .................................................................................... 17-34
DROP CLUSTER ...................................................................................................... 17-36
DROP CONTEXT ...................................................................................................... 17-38
DROP DATABASE ..................................................................................................... 17-39
DROP DATABASE LINK ............................................................................................. 17-40
DROP DIMENSION .................................................................................................... 17-41
DROP DIRECTORY .................................................................................................... 17-42
DROP DISKGROUP .................................................................................................... 17-43
DROP EDITION ......................................................................................................... 17-45
DROP FLASHBACK ARCHIVE ...................................................................................... 17-47
DROP FUNCTION ...................................................................................................... 17-48
DROP INDEX............................................................................................................. 17-50
DROP INDEXTYPE ..................................................................................................... 17-52
DROP JAVA ............................................................................................................... 17-53
DROP LIBRARY .......................................................................................................... 17-54
DROP MATERIALIZED VIEW......................................................................................... 17-55
DROP MATERIALIZED VIEW LOG ................................................................................ 17-57
DROP OPERATOR ....................................................................................................... 17-59
DROP OUTLINE .......................................................................................................... 17-60
DROP PACKAGE ......................................................................................................... 17-62
DROP PROCEDURE .................................................................................................... 17-64
DROP PROFILE .......................................................................................................... 17-65

DROP RESTORE POINT .............................................................................................. 17-66
DROP ROLE ............................................................................................................... 17-67
DROP ROLLBACK SEGMENT ........................................................................................ 17-68

 

18 SQL Statements: DROP SEQUENCE to ROLLBACK
DROP SEQUENCE ........................................................................................................ 18-2
DROP SYNONYM ......................................................................................................... 18-3
DROP TABLE ............................................................................................................... 18-5
DROP TABLESPACE ..................................................................................................... 18-9
DROP TRIGGER.......................................................................................................... 18-12
DROP TYPE ............................................................................................................... 18-13
DROP TYPE BODY ...................................................................................................... 18-15
DROP USER ............................................................................................................... 18-16
DROP VIEW ............................................................................................................... 18-18
EXPLAIN PLAN ........................................................................................................... 18-20
FLASHBACK DATABASE................................................................................................ 18-24
FLASHBACK TABLE ..................................................................................................... 18-27
GRANT ...................................................................................................................... 18-33
INSERT ..................................................................................................................... 18-54
LOCK TABLE .............................................................................................................. 18-71
MERGE ..................................................................................................................... 18-74
NOAUDIT .................................................................................................................. 18-79
PURGE ...................................................................................................................... 18-83
RENAME .................................................................................................................... 18-85
REVOKE .................................................................................................................... 18-87
ROLLBACK ................................................................................................................. 18-96

 

19 SQL Statements: SAVEPOINT to UPDATE
SAVEPOINT ................................................................................................................. 19-2
SELECT ....................................................................................................................... 19-4
SET CONSTRAINT[S] .................................................................................................. 19-59
SET ROLE .................................................................................................................. 19-61
SET TRANSACTION .................................................................................................... 19-64
TRUNCATE CLUSTER .................................................................................................. 19-67
TRUNCATE TABLE ...................................................................................................... 19-69
UPDATE ..................................................................................................................... 19-73

 

A How to Read Syntax Diagrams
Graphic Syntax Diagrams................................................................................................. A-1
Required Keywords and Parameters ................................................................................. A-2
Optional Keywords and Parameters .................................................................................. A-3
Syntax Loops................................................................................................................... A-3
Multipart Diagrams .......................................................................................................... A-4
Database Objects ............................................................................................................ A-4

B Automatic and Manual Locking Mechanisms During SQL Operations
Automatic Locks in DML Operations .................................................................................. B-1
Automatic Locks in DDL Operations................................................................................... B-4
Exclusive DDL Locks......................................................................................................... B-4
Share DDL Locks.............................................................................................................. B-4
Breakable Parse Locks ..................................................................................................... B-5
Manual Data Locking ....................................................................................................... B-5
C Oracle and Standard SQL
ANSI Standards .............................................................................................................. C-1
ISO Standards ................................................................................................................ C-2
Oracle Compliance To Core SQL:2008 .............................................................................. C-3
Oracle Support for Optional Features of SQL/Foundation:2008............................................ C-9
Oracle Compliance with SQL/CLI:2008 ............................................................................ C-20
Oracle Compliance with SQL/PSM:2008 ........................................................................... C-20
Oracle Compliance with SQL/MED:2008 .......................................................................... C-20
Oracle Compliance with SQL/OLB:2008............................................................................ C-21
Oracle Compliance with SQL/JRT:2008............................................................................ C-21
Oracle Compliance with SQL/XML:2008........................................................................... C-21
Oracle Compliance with FIPS 127-2 ............................................................................... C-25
Oracle Extensions to Standard SQL ................................................................................ C-26
Oracle Compliance with Older Standards ........................................................................ C-27
Character Set Support................................................................................................... C-27
D Oracle Regular Expression Support
Multilingual Regular Expression Syntax ........................................................................... D-1
Regular Expression Operator Multilingual Enhancements................................................... D-2
Perl-influenced Extensions in Oracle Regular Expressions ................................................. D-3
E Oracle SQL Reserved Words and Keywords
Oracle SQL Reserved Words............................................................................................ E-1
Oracle SQL Keywords ..................................................................................................... E-3
F Extended Examples
Using Extensible Indexing ............................................................................................... F-1
Using XML in SQL Statements ......................................................................................... F-8
Index

 

 

Preface
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:1999 standard.
This Preface contains these topics:
■ Audience
■ Documentation Accessibility
■ Related Documents
■ Conventions

 

Audience
The Oracle Database SQL Language Reference is intended for all users of Oracle SQL.

 

Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at oracle.com/pls/topic/lookup?ctx=acc&id=docacc.

 

Access to Oracle Support
Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit
oracle.com/pls/topic/lookup?ctx=acc&id=info or visit
oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.


Related Documents
For more information, see these Oracle resources:
■ Oracle Database PL/SQL Language Reference for information on PL/SQL, the procedural language extension to Oracle SQL
■ Pro*C/C++ Programmer's Guide, Oracle SQL*Module for Ada Programmer's Guide, and the Pro*COBOL Programmer's Guide for detailed descriptions of Oracle embedded SQL
Many of the examples in this book use the sample schemas, which are installed by default when you select the Basic Installation option with an Oracle Database

installation. Refer to Oracle Database Sample Schemas for information on how these schemas were created and how you can use them yourself.

 

Introduction to Oracle SQL
Structured Query Language (SQL) is the set of statements with which all programs and users access data in an Oracle Database. Application programs and Oracle tools often allow users access to the database without using SQL directly, but these applications in turn must use SQL when executing the user's request. This chapter provides background information on SQL as used by most database systems.

This chapter contains these topics:
■ History of SQL
■ SQL Standards
■ Lexical Conventions
■ Tools Support

 

History of SQL
Dr. E. F. Codd published the paper, "A Relational Model of Data for Large Shared Data Banks", in June 1970 in the Association of Computer Machinery (ACM) journal, Communications of the ACM. Codd's model is now accepted as the definitive model for relational database management systems (RDBMS). The language, Structured English Query Language (SEQUEL) was developed by IBM Corporation, Inc., to use Codd's model. SEQUEL later became SQL (still pronounced "sequel"). In 1979, Relational Software, Inc. (now Oracle) introduced the first commercially available implementation of SQL. Today, SQL is accepted as the standard RDBMS language.

 

SQL Standards
Oracle strives to comply with industry-accepted standards and participates actively in SQL standards committees. Industry-accepted committees are the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO), which is affiliated with the International Electrotechnical Commission (IEC).
Both ANSI and the ISO/IEC have accepted SQL as the standard language for relational databases. When a new SQL standard is simultaneously published by these organizations, the names of the standards conform to conventions used by the organization, but the standards are technically identical.
The latest SQL standard was adopted in July 2008 and is often called SQL:2008. The formal names of this standard are:
■ ANSI/ISO/IEC 9075:2008, "Database Language SQL", Parts 1 ("SQL/Framework"), 2 ("SQL/Foundation"), 3 ("SQL/CLI"), 4 ("SQL/PSM"), 9

("SQL/MED"), 10 ("SQL/OLB"), 11("SQL/Schemata"), 13 ("SQL/JRT"), and ANSI/ISO/IEC 9075-14:2008, "Database Language SQL", Part 14 ("SQL/XML")
■ ISO/IEC 9075:2008, "Database Language SQL", Parts 1 ("SQL/Framework"), 2 ("SQL/Foundation"), 3 ("SQL/CLI"), 4 ("SQL/PSM"), 9 ("SQL/MED"), 10 ("SQL/OLB"), 11("SQL/Schemata"), 13 ("SQL/JRT"), and ISO/IEC 9075-14:2008, "Database Language SQL", Part 14 ("SQL/XML")

 

How SQL Works
The strengths of SQL provide benefits for all types of users, including application programmers, database administrators, managers, and end users. Technically speaking, SQL is a data sublanguage. The purpose of SQL is to provide an interface to a relational database such as Oracle Database, and all SQL statements are instructions to the database. In this SQL differs from general-purpose programming languages like C and BASIC. Among the features of SQL are the following:
■ It processes sets of data as groups rather than as individual units.
■ It provides automatic navigation to the data.
■ It uses statements that are complex and powerful individually, and that therefore
stand alone. Flow-control statements were not part of SQL originally, but they are found in the recently accepted optional part of SQL, ISO/IEC 9075-5: 1996. Flow-control statements are commonly known as "persistent stored modules" (PSM), and the PL/SQL extension to Oracle SQL is similar to PSM. SQL lets you work with data at the logical level. You need to be concerned with the implementation details only when you want to manipulate the data. For example, to retrieve a set of rows from a table, you define a condition used to filter the rows. All rows satisfying the condition are retrieved in a single step and can be passed as a unit to the user, to another SQL statement, or to an application. You need not deal with the rows one by one, nor do you have to worry about how they are physically stored or retrieved. All SQL statements use the optimizer, a part of Oracle Database that determines the most efficient means of accessing the specified data. Oracle also provides techniques that you can use to make the optimizer perform its job better.


SQL provides statements for a variety of tasks, including:
■ Querying data
■ Inserting, updating, and deleting rows in a table
■ Creating, replacing, altering, and dropping objects
■ Controlling access to the database and its objects
■ Guaranteeing database consistency and integrity
SQL unifies all of the preceding tasks in one consistent language.

 

Common Language for All Relational Databases
All major relational database management systems support SQL, so you can transfer all skills you have gained with SQL from one database to another. In addition, all programs written in SQL are portable. They can often be moved from one database to another with very little modification.

 

لینک دانلود کتاب Oracle Database SQL Language Reference.pdf

 

عضویت در خبرنامه