Cover | Table of Contents | Index | Sample Chapter | Colophon
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Z ]
Symbols[ Top ]
& (ampersand) command (SQL*Plus), 238
* arithmetic operator, 15, 282
** arithmetic operator, 282
&& command (SQL*Plus), 239
@ command (SQL*Plus), 221
@@ command (SQL*Plus), 222
!< comparison operator, 16
!= comparison operator, 16, 282
!> comparison operator, 16
< comparison operator, 16, 282
<= comparison operator, 16, 282
= comparison operator, 16, 282
> comparison operator, 16, 282
>= comparison operator, 16, 282
^= comparison operator, 16
~= comparison operator, 282
+ (identity) arithmetic operator, 15, 281
- (minus) arithmetic operator, 15, 281
- (negation) arithmetic operator, 15, 281
+ (plus) arithmetic operator, 15, 281
/ (slash) arithmetic operator, 15, 282
< > comparison operator, 16, 282
| | concatenation operator, 15, 281
A[ Top ]
ABS function, 153
abstract data types (ADTs), xxi
ACCEPT command (SQL*Plus), 239
access method hints, 356-357
ACOS function, 153
Ada programming language, xvi
ADD_MONTHS function, 174
ADTs (abstract data types), xxi
aggregate functions, 146-153
ALL keyword and, 147
DISTINCT keyword and, 147
GROUP BY clause and, 146
NULL values and, 148
AGGREGATE option (EXPLAIN PLAN), 333
ALL comparison operator, 17
ALL keyword, 147
ALL option (EXPLAIN PLAN), 333
ALL_ROWS hint, 355
ALTER CLUSTER statement, 25
DDL tasks, 33
syntax of, 49-52
ALTER DATABASE statement, 25
DDL tasks, 33-38
syntax of, 54-60
ALTER FUNCTION statement, 25
DDL tasks, 36
PL/SQL functions and, 312
ALTER INDEX statement, 25
DDL tasks, 33
syntax of, 64-70
ALTER MATERIALIZED VIEW LOG statement, 25
DDL tasks, 34
syntax of, 72
ALTER MATERIALIZED VIEW statement, 25
DDL tasks, 34
syntax of, 70-72
ALTER PACKAGE statement, 25
DDL tasks, 36
PL/SQL packages and, 317
ALTER PROCEDURE statement, 25
DDL tasks, 37
PL/SQL procedures and, 308
ALTER PROFILE statement, 25
DDL tasks, 33, 35, 37
syntax of, 73-76
ALTER RESOURCE COST statement, 25
DDL tasks, 33
syntax of, 38
ALTER ROLE statement, 25
DDL tasks, 33
syntax of, 76
ALTER ROLLBACK SEGMENT statement, 25
DDL tasks, 33-37
syntax of, 77
ALTER SEQUENCE statement, 25
DDL tasks, 33
syntax of, 79-81
ALTER SESSION statement, 25
DDL tasks, 34
DML tasks, 106
SQL Trace
enabling, 337
setting parameters, 335
syntax of, 107-116
ALTER SNAPSHOT LOG statement, 26
DDL tasks, 34
syntax of, 83
ALTER SNAPSHOT statement, 25
DDL tasks, 34
syntax of, 81-83
ALTER SYSTEM statement, 26
DDL tasks, 33
SQL Trace parameters, setting, 335
syntax of, 39-43
ALTER TABLE statement, 26
DDL tasks, 33, 36
syntax of, 85-91
ALTER TABLESPACE statement, 26
DDL tasks, 33, 36, 38
syntax of, 92-94
ALTER TRIGGER statement, 26
DDL tasks, 36
PL/SQL triggers and, 322
ALTER USER statement, 26
DDL tasks, 33
syntax of, 95-97
ALTER VIEW statement, 26
DDL tasks, 37
syntax of, 97-99
ANALYZE statement, 26
DDL tasks, 34, 36-38
DML tasks, 106
syntax of, 116
AND logical operator, 18, 282
AND_EQUAL hint, 357
AND-EQUAL operation (EXPLAIN PLAN), 331
anonymous blocks, PL/SQL, 263
ANSI SQL, xix, xxv
character datatype compatibility, 7
numeric datatype compatibility, 9
ANTI option (EXPLAIN PLAN), 332
ANY comparison operator, 17
APOUG (Asia-Pacific Oracle Users Group), 363
APPEND command (SQL*Plus), 208
APPEND hint, 359
APPINFO command (SQL*Plus), 241
ARCHIVE LOG command, 222
arithmetic operators, 14, 281
arrays, variable-sized, 275-277
ARRAYSIZE command (SQL*Plus), 242
ASCII function, 162
Asia-Pacific Oracle Users Group (APOUG), 363
ASIN function, 154
assignment statements, PL/SQL, 281
ASSOCIATE STATISTICS statement, 26
DDL tasks, 33
syntax of, 44
ATAN function, 154
ATAN2 function, 154
AUDIT statement (schema objects), 26
DDL tasks, 33
syntax of, 45
AUDIT statement (SQL statements), 26
DDL tasks, 33
syntax of, 46
Australian Oracle User Group (AUSOUG), 363
AUTOCOMMIT command (SQL*Plus), 242
Autoextend_Clause, 133
AUTOPRINT command (SQL*Plus), 242
AUTORECOVERY command (SQL*Plus), 243
AUTOTRACE command (SQL*Plus), 243
autotrace (see SET AUTOTRACE command)
AVG function, 148
B[ Top ]
BETWEEN comparison operator, 17, 282
BFILE datatype
Oracle, 8
PL/SQL, 268
BFILE objects, storing, 63
BFILENAME function, 190
BINARY_INTEGER datatype (PL/SQL), 267
BITMAP operation (EXPLAIN PLAN), 331
blank lines
setting number of, 252
in SQL commands, 256
BLOB columns, initializing, 195
BLOB datatype
Oracle, 8
PL/SQL, 268
block headers, PL/SQL, 263, 265
blocks, PL/SQL (see PL/SQL, blocks)
BLOCKTERMINATOR command (SQL*Plus), 244
books, Oracle, 361
BOOLEAN datatype (PL/SQL), 268
Boyce, Ray, x
BREAK command (SQL*Plus)
with parameters, 212
without parameters, 212
BTITLE command (SQL*Plus)
controlling, 213
defining, 213
displaying, 214
buffer, SQL*Plus, 208-211
BY ROWID option (EXPLAIN PLAN), 334
C[ Top ]
C++ programming language, xvii
CACHE hint, 360
CALL statement, 26, 47
Cartesian product, 23
case conversion, SQL and PL/SQL, 257
CEIL function, 155
Chamberlin, Don, x
CHANGE command (SQL*Plus), 208
CHAR datatype
Oracle, 6
PL/SQL, 267
CHAR VARYING datatype, 7
CHARACTER datatype
Oracle, 7
PL/SQL, 267
character functions, 162-174
character strings, 182-190
converting dates to, 184
converting numbers to, 185-187
CHARACTER VARYING datatype, 7
CHARTOROWID function, 182
CHOOSE hint, 355
CHR function, 162
CLEAR command (SQL*Plus), 209, 214
CLOB columns, initializing, 195
CLOB data and LOBOFFSET command, 251
CLOB datatype
Oracle, 8
PL/SQL, 268
CLOB values, displaying, 251
CLOSE statement (PL/SQL), 295
CLOSECURSOR command (SQL*Plus), 244
CLUSTER hint, 357
CLUSTER option (EXPLAIN PLAN), 333
clusters
changing, 49-52
creating, 49-52
removing, 49-52
removing rows from, 129
CMDSEP command (SQL*Plus), 244
CODASYL (Conference on Data Systems Languages), xix
Codd, E.F., ix-xiii, xxv
COLSEP command (SQL*Plus), 245
COLUMN command (SQL*Plus), 214-216
Column_Constraint_Clause, 134
columns
adding comments about, 48
adding to tables, 85-91
associating statistics with, 44
clusters and, 49
creating indexes on, 64-70
defining constraints of, 134
disassociating statistics from, 99
modifying, 86-91
specifying display characteristics for, 214-216
command-line syntax, SQL*Plus, 204-207
COMMENT statement, 26
DDL tasks, 33
syntax of, 48
committing changes to databases, 242
comparison operators, 15-18, 282
COMPATIBILITY command (SQL*Plus), 245
composite partitioning, 139-141
COMPUTE command (SQL*Plus), 216
CONCAT command (SQL*Plus), 245
CONCAT function, 163
CONCATENATION operation (EXPLAIN PLAN), 332
concatenation operator, 15, 281
condition component of SQL statements, 23
Conference on Data Systems Languages (CODASYL), xix
CONNECT BY operation (EXPLAIN PLAN), 332
CONNECT command (SQL*Plus), 223
INSTANCE command and, 250
constraints
defining column, 134
defining table, 143
disabling/enabling, 135-137
setting, 126
Constraint_State_Clause, 135-137
control files, creating, 52-53
control statements, PL/SQL, 282-288
CONVERSION COUNT option (EXPLAIN PLAN), 331
CONVERSION FROM ROWIDS option (EXPLAIN PLAN), 331
conversion functions, 182-190
CONVERSION TO ROWIDS option (EXPLAIN PLAN), 331
CONVERT function, 183
COPY command (SQL*Plus), 224
COPYCOMMIT command (SQL*Plus), 246
COPYTYPECHECK command (SQL*Plus), 246
COS function, 155
COSH function, 155
cost-based optimizer, 325, 356
gathering statistics, 351
query costs and, 330
COUNT function, 149
COUNT method (PL/SQL)
index-by tables, 273
variable-sized arrays, 276
COUNT operation (EXPLAIN PLAN), 332
COUNT statistic, SQL Trace, 343
CPU statistic, SQL Trace, 343
CPU times and tkprof reports, 344
CREATE CLUSTER statement, 26
DDL tasks, 34
syntax of, 49-52
CREATE CONTROLFILE statement, 26
DDL tasks, 33, 34, 37
syntax of, 52-53
CREATE DATABASE LINK statement, 27
DDL tasks, 34
syntax of, 60
CREATE DATABASE statement, 26
DDL tasks, 34
syntax of, 54-60
CREATE DIMENSION statement, 27
DDL tasks, 34
syntax of, 61-63
CREATE DIRECTORY statement, 27
DDL tasks, 34
syntax of, 63
CREATE FUNCTION statement, 27
DDL tasks, 35
PL/SQL functions and, 309-312
CREATE INDEX statement, 27
DDL tasks, 35
syntax of, 64-70
CREATE MATERIALIZED VIEW LOG statement, 27
DDL tasks, 34
syntax of, 72
CREATE MATERIALIZED VIEW statement, 27
DDL tasks, 34
syntax of, 70-72
CREATE PACKAGE BODY statement
DDL tasks, 34
PL/SQL packages and, 315
CREATE PACKAGE statement, 27
DDL tasks, 34
PL/SQL packages and, 314
CREATE PROCEDURE statement, 27
PL/SQL procedures and, 304-307
CREATE PROFILE statement, 27
DDL tasks, 34
syntax of, 73-76
CREATE ROLE statement, 27
DDL tasks, 35
syntax of, 76
CREATE ROLLBACK SEGMENT statement, 27
DDL tasks, 35
syntax of, 77
CREATE SCHEMA statement, 27
DDL tasks, 36
syntax of, 78
CREATE SEQUENCE statement, 28
DDL tasks, 35
syntax of, 79-81
CREATE SNAPSHOT LOG statement, 28
DDL tasks, 35
syntax of, 83
CREATE SNAPSHOT statement, 28
DDL tasks, 35
syntax of, 81-83
CREATE SYNONYM statement, 28
DDL tasks, 34
syntax of, 84
CREATE TABLE AS statement
DDL tasks, 34
CREATE TABLE statement, 28
DDL tasks, 35
syntax of, 85-91
CREATE TABLESPACE statement, 28
DDL tasks, 34
syntax of, 92-94
CREATE TEMPORARY TABLESPACE statement, 28
DDL tasks, 35
syntax of, 94-95
CREATE TRIGGER statement, 28
DDL tasks, 34
PL/SQL triggers and, 320-322
CREATE USER statement, 28
DDL tasks, 34
syntax of, 95-97
CREATE VIEW statement, 28
DDL tasks, 35
syntax of, 97-99
CUBE keyword, xix, 149
current line, SQL*Plus, 208-211
CURRENT statistic, SQL Trace, 344
CURRVAL pseudo-column, 12
cursor FOR loop, 295
CURSOR statement (PL/SQL), 277
CURSOR_ALREADY_OPEN exception (PL/SQL), 299
cursors
PL/SQL (see PL/SQL, cursors)
SQL*Plus, 244
D[ Top ]
data access languages, vii
data conversion, 13
Data Definition Language (see DDL)
data dictionary, xi
adding comments to, 48
Data Manipulation Language (see DML)
database instances, making dynamic changes to, 39-43
database links
creating, 60
removing, 60
database objects
associating statistics with, 44
creating synonyms for, 84
disassociating statistics from, 99
granting privileges on, 100
listing definitions for, 225
removing synonyms from, 84
revoking privileges on, 104
database structure and performance improvements, 351
databases
changing characteristics of, 54-60
committing pending changes to, 242
connecting to, 223
connecting to default, 250
copying data from/to, 224
creating, 54-60
object-relational, xvii
performing recovery operations on, 228-230
triggers, 319
datatypes
conversion functions for, 182-190
Oracle, 6-11
PL/SQL, 267-268
Date, Chris, xi
DATE datatype
Oracle, 9
PL/SQL, 268
dates
converting to character strings, 184
format elements for, 179
functions, 174-181
returning current, 180
DBMS_APPLICATION_INFO package, 241
DBMS_OUTPUT.PUT_LINE procedure, 255
DBMS_SYSTEM package, 336-338
DDL (Data Definition Language)
common tasks, 33-38
SQL statement syntax, 38-105
SQL clauses, 133-144
statements used in PL/SQL
functions, 309-313
packages, 313-318
procedures, 304-309
triggers, 318-323
DEC datatype, 267
DECIMAL datatype
Oracle, 9
PL/SQL, 267
declaration section (see PL/SQL, blocks)
DECODE function, 191-193
default databases, connecting to, 250
deferrable constraints, 126
DEFINE command (SQL*Plus), 240, 246
DEL command (SQL*Plus), 209
DELETE method (PL/SQL)
index-by tables, 273
variable-sized arrays, 276
DELETE statement, 21, 28
DML tasks, 106
in PL/SQL programs, 293
syntax of, 117
trigger events and, 318-321
DESCRIBE command (SQL*Plus), 225
Digital Equipment Corporation, xiv
dimensions
creating, 61-63
removing, 61-63
directory objects
creating, 63
removing, 63
DISASSOCIATE STATISTICS statement, 28
syntax of, 99
DISCONNECT command (SQL*Plus), 225
DISK statistic, SQL Trace, 343
display devices, sending output to, 249
DISTINCT keyword, 147
DML (Data Manipulation Language)
common tasks, 106
SQL statement syntax, 107-132
SQL clauses, 133-144
statements used in PL/SQL, 288
trigger types, 318-323
DOS/VSE operating system, xiii
dot notation, 5
referencing fields in a record, 270
DOUBLE PRECISION datatype
Oracle, 9
PL/SQL, 267
DRIVING_SITE hint, 359
DROP CLUSTER statement, 28
DDL tasks, 35, 37
syntax of, 49-52
DROP DATABASE LINK statement, 28
DDL tasks, 35, 37
syntax of, 60
DROP DIMENSION statement, 29
DDL tasks, 35, 37
syntax of, 61-63
DROP DIRECTORY statement, 29
DDL tasks, 35, 37
syntax of, 63
DROP FUNCTION statement, 29
DDL tasks, 35, 37
PL/SQL functions and, 312
DROP INDEX statement, 29
DDL tasks, 36, 37
syntax of, 64-70
DROP MATERIALIZED VIEW LOG statement, 29
DDL tasks, 35, 37
syntax of, 72
DROP MATERIALIZED VIEW statement, 29
DDL tasks, 35, 37
syntax of, 70-72
DROP PACKAGE statement, 29
DDL tasks, 35, 37
PL/SQL packages and, 318
DROP PROCEDURE statement, 29
PL/SQL procedures and, 308
DROP PROFILE statement, 29
DDL tasks, 35, 37
syntax of, 73-76
DROP ROLE statement, 29
DDL tasks, 35, 37
syntax of, 76
DROP ROLLBACK SEGMENT statement, 29
DDL tasks, 35, 37
syntax of, 77
DROP SEQUENCE statement, 29
DDL tasks, 35, 37
syntax of, 79-81
DROP SNAPSHOT LOG statement, 29
DDL tasks, 35, 37
syntax of, 83
DROP SNAPSHOT statement, 29
DDL tasks, 35, 37
syntax of, 81-83
DROP SYNONYM statement, 28
DDL tasks, 35, 37
syntax of, 84
DROP TABLE statement, 29
DDL tasks, 36, 37
syntax of, 85-91
DROP TABLESPACE statement, 29
DDL tasks, 35, 37
syntax of, 92-94
DROP TRIGGER statement, 29
DDL tasks, 35, 37
PL/SQL triggers and, 323
DROP USER statement, 29
DDL tasks, 36, 37
syntax of, 95-97
DROP VIEW statement, 30
DDL tasks, 36, 37
syntax of, 97-99
DUMP function, 194
DUP_VAL_ON_INDEX exception (PL/SQL), 299
E[ Top ]
ECHO command (SQL*Plus), 246
EDIT command (SQL*Plus), 226
EDITFILE command (SQL*Plus), 247
ELAPSED statistic, SQL Trace, 343
elapsed times and tkprof reports, 344
Ellison, Larry, xii
EMBEDDED command (SQL*Plus), 247
Embedded SQL, xi
EMPTY_BLOB function, 195
EMPTY_CLOB function, 195
EOUG (European Oracle Users Group), 363
errors
operating system, 236
Oracle, 299
SQL statement, 237
ESCAPE command (SQL*Plus), 247
European Oracle Users Group (EOUG), 363
exception handling, PL/SQL (see PL/SQL, exception handling)
EXCEPTION statement (PL/SQL), 279
EXECUTE command (SQL*Plus), 226
execution phase, SQL statement execution, 343
execution plans (see EXPLAIN PLAN statement)
execution section (see PL/SQL, blocks)
EXISTS comparison operator, 17
EXISTS method (PL/SQL)
index-by tables, 273
variable-sized arrays, 276
EXIT command (SQL*Plus), 226
EXP function, 156
EXPLAIN PLAN statement, 30
creating the plan table, 326
DDL tasks, 35
DML tasks, 106
explaining a plan, 327
hierarchical queries, 328-330
interpreting results, 330-334
operations/options in execution plans, 331-334
performance tuning, 325-334
syntax of, 119, 327
viewing the execution plan, 328-330
explicit data conversion, 14
expressions, PL/SQL, 281
EXTEND method (PL/SQL), variable-sized arrays, 277
F[ Top ]
FEEDBACK command (SQL*Plus), 248
fetch phase, SQL statement execution, 343
FETCH statement (PL/SQL), 294
files
increasing size of, 133
setting default extensions, 258
FILTER operation (EXPLAIN PLAN), 332
FIRST method (PL/SQL)
index-by tables, 273
variable-sized arrays, 277
FIRST ROW operation (EXPLAIN PLAN), 332
FIRST_ROWS hint, 355
FLAGGER command (SQL*Plus), 248
FLOAT datatype
Oracle, 9
PL/SQL, 267
FLOOR function, 156
FLUSH command (SQL*Plus), 249
footers, formatting (see REPFOOTER command)
FOR loop, 286
FOR loop, cursor, 295
FOR UPDATE operation (EXPLAIN PLAN), 332
format elements
date, 179
numeric, 186
formatting SQL*Plus output, 211-221
%FOUND cursor attribute, 297
FULL hint, 357
FULL option (EXPLAIN PLAN), 333
functions, PL/SQL, 309-313
characteristics of, 304
Oracle built-in functions, 145-203
SQL, 145-203
G[ Top ]
GET command (SQL*Plus), 209
global PL/SQL variables, 313
GOTO statement (PL/SQL), 287
GRANT statement (object privileges), 30
DDL tasks, 36
syntax of, 100
GRANT statement (system privilege or role), 30
DDL tasks, 33, 36
syntax of, 101
GREATEST function, 156
GROUP BY clause, xix, 146
GROUP BY option (EXPLAIN PLAN), 333
GROUPING function, 149
H[ Top ]
HASH hint, 357
hash join method, 358
HASH JOIN operation (EXPLAIN PLAN), 332
HASH option (EXPLAIN PLAN), 333
hash partitioning, 139-141
HASH_AJ hint, 357
headers, formatting (see REPHEADER command), 219
HEADING command (SQL*Plus), 249
HEADSEP command (SQL*Plus), 249
HELP command (SQL*Plus), 227
HEXTORAW function, 183
hierarchical queries and execution plans, 328-330
hints
access method, 356-357
join operation, 358
join order, 357
optimizer, 352-355
optimizer goal, 355
parallel execution, 359
HOST command (SQL*Plus), 227
host variables, xi
hostname keyword (SQL*Plus), 206
HTML output, generating, 251
I[ Top ]
IBM
commercial development of SQL at, xii
origins of SQL at, ix
IF-THEN-ELSE statements (PL/SQL), 282-284
implicit data conversion, 14
IN comparison operator, 16, 282
INDEX FULL SCAN option (EXPLAIN PLAN), 331
INDEX hint, 357
INDEX operation (EXPLAIN PLAN), 332
INDEX RANGE SCAN option (EXPLAIN PLAN), 331
INDEX SINGLE VALUE option (EXPLAIN PLAN), 331
INDEX_ASC hint, 357
index-by tables
declaring, 271
methods for, 273
INDEX_COMBINE hint, 357
INDEX_DESC hint, 357
indexes
access method hints and, 356-357
changing, 64-70
creating, 64-70, 351
performance improvements and, 351
removing, 64-70
INDEX_FFS hint, 357
Informix Corporation, xiv
Ingres Corporation, xiii
INITCAP function, 163
initialization parameters
ALTER SESSION statement, 115
SQL Trace, 335
INIT.ORA initialization file, 115, 335
INLIST ITERATOR operation (EXPLAIN PLAN), 332
INLIST option (EXPLAIN PLAN), 333
INPUT command (SQL*Plus), 210
INSERT statement, 21, 30
DML tasks, 107
in PL/SQL programs, 291
syntax of, 120
trigger events and, 318-322
INSTANCE command (SQL*Plus), 250
INSTR function, 163
INSTRB function, 164
INT datatype
Oracle, 9
PL/SQL, 267
INTEGER datatype
Oracle, 9
PL/SQL, 267
International Oracle Users Group-Americas (IOUG-A), 362
INTERSECT set operator, 20
INTERSECTION operation (EXPLAIN PLAN), 332
INVALID_CURSOR exception (PL/SQL), 299
INVALID_NUMBER exception (PL/SQL), 299
IOUG-A (International Oracle Users Group-Americas), 362
IS NOT NULL comparison operator, 18
IS NULL comparison operator, 18, 282
%ISOPEN cursor attribute, 297
ITERATOR option (EXPLAIN PLAN), 333
J[ Top ]
Jacobs, Ken, vii-xxiv
Java and SQL, xviii
join operation hints, 358
JOIN option (EXPLAIN PLAN), 333
join order hints, 357
joins, 22
Oracle hints and, 357
K[ Top ]
key columns, 22
keywords
SQL, 2
SQL*Plus, 205-207
King, Frank, ix
L[ Top ]
languages, data access/programming, vii
large object (LOB) datatypes
converting values into, 188
Oracle, 7
PL/SQL, 268
LAST method (PL/SQL)
index-by tables, 273
variable-sized arrays, 277
LAST_DAY function, 175
LEAST function, 157
LENGTH function, 165
LENGTHB function, 165
LEVEL pseudo-column, 13
library cache misses and tkprof reports, 344
LIKE comparison operator, 18, 282
LIMIT method (PL/SQL), variable-sized arrays, 277
LINESIZE command (SQL*Plus), 250
LIST command (SQL*Plus), 210
literals, SQL, 2
LN function, 157
LOB datatypes, 7
converting values into, 188
LOBOFFSET command (SQL*Plus), 251
LOB_Storage_Clause, 137-139
LOG function, 158
logarithmic functions, 153-162
logfiles, performing recovery operations on, 228-230
logical operators, 18, 282
LOGIN_DENIED exception (PL/SQL), 299
LONG command (SQL*Plus), 251
LONG datatype
Oracle, 7
PL/SQL, 267
LONG RAW datatype
Oracle, 7
PL/SQL, 267
LONGCHUNKSIZE command (SQL*Plus), 251
LOOP statement (PL/SQL), 284
LOWER function, 165
LPAD function, 165
LTRIM function, 166
M[ Top ]
MARKUP HTML command (SQL*Plus), 251
materialized view logs
changing, 72
creating, 72
removing, 72
materialized views
changing, 70-72
creating, 70-72
removing, 70-72
MAX function, 150
MAX_DUMP_FILE_SIZE parameter, 336-338
merge join method, 358
MERGE JOIN operation (EXPLAIN PLAN), 332
MERGE option (EXPLAIN PLAN), 331
MERGE_AJ hint, 357
MIN function, 151
MINUS operation (EXPLAIN PLAN), 332
MINUS option (EXPLAIN PLAN), 331
MINUS set operator, 20
MOD function, 158
months, adding to dates, 174
MONTHS_BETWEEN function, 175
N[ Top ]
named blocks, PL/SQL, 264
namespaces, returning attribute values in, 197-200
naming requirements in SQL, 3
NATIONAL CHAR datatype, 7
NATIONAL CHAR VARYING datatype, 7
NATIONAL CHARACTER datatype, 7
NATIONAL CHARACTER VARYING datatype, 7
National Committee for Information Technology Standards (NCITS), xix
National Language Support (NLS)
character sets and NCLOB data, 8
characteristics, changing, 111
functions, 167, 196
NATURAL datatype (PL/SQL), 267
NCHAR datatype
Oracle, 7
PL/SQL, 267
NCHAR VARYING datatype, 7
NCITS (National Committee for Information Technology Standards), xix
NCLOB data and LOBOFFSET command, 251
NCLOB datatype
Oracle, 8
PL/SQL, 268
NCLOB values, displaying, 251
NCR, xiv
nested loops join method, 358
NESTED LOOPS operation (EXPLAIN PLAN), 333
NEWPAGE command (SQL*Plus), 252
NEW_TIME function, 176
NEXT method (PL/SQL)
index-by tables, 274
variable-sized arrays, 277
NEXT_DAY function, 178
NEXTVAL pseudo-column, 12
NLS (see National Language Support)
NLS_CHARSET_DECL_LEN function, 196
NLS_CHARSET_ID function, 196
NLS_CHARSET_NAME function, 196
NLS_INITCAP function, 167
NLS_LOWER function, 167
NLSSORT function, 168
NLS_UPPER function, 167
NOAPPEND hint, 359
NOAUDIT statement (schema objects), 30
DDL tasks, 36, 38
syntax of, 102
NOAUDIT statement (SQL statements), 30
DDL tasks, 36, 38
syntax of, 102
NOCACHE hint, 360
NO_DATA_FOUND exception (PL/SQL), 299
NO_MERGE hint, 359
NonStop SQL, xv
NO_PARALLEL hint, 359
normalization theory, ix
NOT BETWEEN comparison operator, 17
NOT EXISTS comparison operator, 17
NOT IN comparison operator, 16
NOT LIKE comparison operator, 18
NOT logical operator, 19, 282
%NOTFOUND cursor attribute, 297
NOT_LOGGED_ON exception (PL/SQL), 299
NULL command (SQL*Plus), 252
NULL statement (PL/SQL), 288
NULL values
aggregate functions and, 148
DECODE function and, 191-193
GROUPING function and, 149
NVL function and, 197
NUMBER datatype
Oracle, 8
PL/SQL, 267
numbers
converting to character strings, 185-187
formatting, 253
NUMERIC datatype
Oracle, 9
PL/SQL, 267
numeric format elements, 186
numeric functions, 153-162
NUMFORMAT command (SQL*Plus), 253
NUMWIDTH command (SQL*Plus), 253
NVARCHAR2 datatype
Oracle, 7
PL/SQL, 267
NVL function, 10, 197
O[ Top ]
Object Option (Oracle), xxvi
OBJECT_NAME column and execution plans, 331
object-oriented programming, xvi
vs. relational database model, xvii
objects, schema (see schema objects)
OPEN statement (PL/SQL), 294
operating system errors, 236
OPERATION column and execution plans, 330
operators
PL/SQL, 281
SQL, 2
optimization, ALTER SESSION statement and, 112
optimizer goal hints, 355
optimizer hints, 352-355
OPTIMIZER_MODE initialization parameter, 325
optimizers, 325
estimating query costs, 330
gathering statistics, 351
option keyword (SQL*Plus), 205
OPTIONS column and execution plans, 330
OR logical operator, 19, 282
OR option (EXPLAIN PLAN), 331
ORA-00001 error, 299
ORA-00051 error, 299
ORA-00061 error, 299
ORA-01001 error, 299
ORA-01012 error, 299
ORA-01017 error, 299
ORA-01404 error, 299
ORA-01422 error, 299
ORA-01476 error, 299
ORA-01722 error, 299
ORA-06500 error, 299
ORA-06501 error, 299
ORA-06502 error, 299
ORA-06504 error, 299
ORA-06511 error, 299
Oracle
aggregate functions, 146, 148-153
built-in functions, 145-203
data conversion, 13
datatypes, 6-11
errors, PL/SQL exception handling for, 299
evolution of, xii
hints, 352-360
access method, 356-357
join operation, 358
join order, 357
optimizer, 352-355
optimizer goal, 355
parallel execution, 359
Object Option, xxvi
relational operators, 14-20
resources, 361-364
schema objects, 3-6
sequence operations, 79-81
SEQUENCE values, 12
special character restrictions, 3
special-purpose data elements, 11-13
specifying session versions, 245
SQL statements, 25-31
executing, 325-334
tuning, 324-360
Trace facility, SQL, 334-345
versions of, xxvi
web sites, 363
Oracle Magazine, 362
ORDER BY option (EXPLAIN PLAN), 333
ORDERED hint, 358
OTHERS exception (PL/SQL), 299
outer joins, 23
OUTER option (EXPLAIN PLAN), 332, 333
P[ Top ]
packages, PL/SQL, 265, 313-318
PAGESIZE command (SQL*Plus), 253
parallel execution hints, 359
PARALLEL hint, 359
PARALLEL_INDEX hint, 360
parameters
initialization, 115, 335
partitioning, 139-141
storage, 137-139
parse counts and tkprof reports, 344
parse phase, SQL statement execution, 343
PARTITION operation (EXPLAIN PLAN), 333
partition syntax, 6
Partition_Clause, 139-141
partition-extended table name, 6
password keyword (SQL*Plus), 206
PAUSE command (SQL*Plus), 227, 253
performance tuning (see SQL statements, tuning)
phases of SQL statement execution, 343
Physical_Attribute_Clause, 141
plan tables
creating, 326
explaining a plan, 327
SET AUTOTRACE command and, 346
PLS_INTEGER datatype (PL/SQL), 267
PL/SQL, xvi, 2, 262-323
assignment statements, 281
blocks
anonymous, 263
block headers, 263, 265
components of, 263
declaration section, 263, 265-280
exception section, 298-304
execution section, 263, 280-298
functions, 264, 304, 309-313
packages, 265, 313-318
procedures, 264, 304-309
triggers, 318-323
case conversion, 257
control statements, 282-288
cursors
attributes of, 297-298
closing, 295
declaring, 277-278
executing, 294-296
opening, 294
reading rows of data, 294
DELETE statement in, 293
DML statements used in, 288
exception handling, 278, 298-304
functions, 301
predefined exceptions, 299
statements, 301-304
user-defined exceptions, 299
expressions, 281
functions, 145-203
INSERT statement in, 291
operators, 281
record variables, declaring, 269-271
SELECT statement in, 289
using SQL statements with, 288-293
structure of, 263
UPDATE statement in, 291
variables (see variables, PL/SQL)
PLUSTRACE database role, 346
plustrce.sql script, 346
POSITIVE datatype (PL/SQL), 267
POWER function, 159
PRAGMA EXCEPTION_INIT statement (PL/SQL), 279
predefined exceptions, PL/SQL, 299
prefix character, setting, 257
PRINT command (SQL*Plus), 240
printing, automatic, 242
PRIOR method (PL/SQL)
index-by tables, 274
variable-sized arrays, 277
Procedural Language/SQL (see PL/SQL)
procedures, PL/SQL, 264, 304-309
profiles
changing, 73-76
creating, 73-76
removing, 73-76
PROGRAM_ERROR exception (PL/SQL), 299
programming languages, vii
PROJECTION operation (EXPLAIN PLAN), 333
prompt
displaying time as part of, 259
setting character sequence for, 257
setting the, 258
pseudo-columns, 11-13
PUSH_SUBQ hint, 360
Q[ Top ]
QUEL vs. SQL, xiii
queries
hierarchical, 328-330
improving performance of, 351-360
rewriting, 351
QUERY statistic, SQL Trace, 344
R[ Top ]
RAISE statement (PL/SQL), 300, 302
RAISE_APPLICATION_ERROR procedure (PL/SQL), 303
range partitioning, 139-141
RANGE SCAN DESCENDING option (EXPLAIN PLAN), 332
RANGE SCAN option (EXPLAIN PLAN), 332
RAW datatype
Oracle, 7
PL/SQL, 267
RAW values
converting hexadecimal digits to, 183
converting into large object (LOB) datatypes, 188
SYS_GUID function and, 201
RAWTOHEX function, 183
Rdb, xiv
RDL (Relational Database Language), xx
REAL datatype
Oracle, 9
PL/SQL, 267
record types, declaring, 269
record variables
declaring, based on a type, 270
referencing fields in, 270
RECOVER command (SQL*Plus), 228-230
AUTORECOVERY command and, 243
RECSEP command (SQL*Plus), 254
RECSEPCHAR command (SQL*Plus), 254
relational completeness, ix
Relational Data Systems, xiv
Relational Database Language (RDL), xx
relational operators, 14-20
Relational Software Incorporated (RSI), xii
Relational Technology Incorporated (RTI), xiii
REMARK command (SQL*Plus), 230
REMOTE operation (EXPLAIN PLAN), 333
RENAME statement, 30
DDL tasks, 34, 37
syntax of, 103
REPFOOTER command (SQL*Plus)
controlling, 217
defining, 218
displaying, 219
REPHEADER command (SQL*Plus)
controlling, 219
defining, 219
displaying, 220
REPLACE function, 169
reports
printing column headings in, 249
SQL*Plus formatting commands for, 211-221
resource costs, calculating, 38
resources, Oracle/SQL, 361-364
REVOKE statement (object privileges), 30
DDL tasks, 36, 37
syntax of, 104
REVOKE statement (system privilege or role), 30
DDL tasks, 33-37
syntax of, 104
roles
changing, 76
creating, 76
disabling/enabling, 127
granting, 101
removing, 76
revoking, 104
ROLLBACK command, SAVEPOINT statement and, 122
rollback segments
changing, 77
creating, 77
removing, 77
transactions and, 128
ROLLUP keyword, xix, 149
ROUND function, 159, 178
%ROWCOUNT cursor attribute, 297
ROWID datatype
Oracle, 11
PL/SQL, 268
ROWID hint, 357
ROWIDTOCHAR function, 184
ROWNUM pseudo-column, 11
rows
accessing multiple, 294-296
deleting, 117
inserting, 120
removing, 129
selecting, 122-126
%ROWTYPE, 271
ROWTYPE_MISMATCH exception (PL/SQL), 299
RPAD function, 169
RSI (Relational Software Incorporated), xii
RTI (Relational Technology Incorporated), xiii
RTRIM function, 170
RULE hint, 355
rule-based optimizer, 325
query costs and, 330
warning against use of, 356
S[ Top ]
SAVE command (SQL*Plus), 211
SAVEPOINT statement, 30
DML tasks, 107
syntax of, 122
scalar variables, declaring, 265-268
schema objects
auditing
setting up, 45
stopping, 102
cluster operations, 49-52
naming requirements for, 3
syntax for, 5
types of, 4
utilizing space, 141
schemas, x
creating, 78
script keyword (SQL*Plus), 206
Select (publication), 362
SELECT statement, 20, 30
DML tasks, 107
in PL/SQL programs, 289
syntax of, 122-126
SEMI option (EXPLAIN PLAN), 332
SEQUEL (Structured English Query Language), x
SEQUENCE operation (EXPLAIN PLAN), 333
SEQUENCE values, 12
sequences
changing, 79-81
creating, 79-81
removing, 79-81
renaming, 103
SERVEROUTPUT command (SQL*Plus)
Oracle7 syntax, 255
Oracle8 syntax, 255
sessions
changing characteristics of, 107-116
disabling/enabling SQL Trace, 336-338
setting parameters for, 115
specifying Oracle versions, 245
SET AUTOTRACE command, 345-349
prerequisites for using, 346
showing statistics and execution plan, 347
showing statistics or execution plan, 348
suppressing query output, 349
SET command (SQL*Plus), 230
SHOWMODE command and, 256
system variables and, 241
SET CONSTRAINT statement, 30
DML tasks, 106
syntax of, 126
set operators, 19
SET ROLE statement, 30
DDL tasks, 36
DML tasks, 107
syntax of, 127
SET TIMING command, 349
SET TRANSACTION statement, 31
DML tasks, 107
syntax of, 128
SET_SQL_TRACE_IN_SESSION procedure, 337
SHIFT command (SQL*Plus), 256
SHOW command (SQL*Plus), 231
system variables and, 241
SHOW ERRORS command (SQL*Plus), 306
SHOWMODE command (SQL*Plus), 256
SHUTDOWN command (SQL*Plus), 232
SIGN function, 160
SIN function, 160
SINGLE option (EXPLAIN PLAN), 333
SMALLINT datatype
Oracle, 9
PL/SQL, 267
snapshot logs
changing, 83
creating, 83
removing, 83
snapshots
changing, 70-72, 81-83
creating, 70-72, 81-83
deleting rows from, 117
removing, 70-72, 81-83
retrieving data from, 122-126
updating data in, 130-132
SOME comparison operator, 17
SORT operation (EXPLAIN PLAN), 333
SOUNDEX function, 171
special characters in SQL statements, 2
SPOOL command (SQL*Plus), 233
spool files, controlling trailing blanks, 260
SQL
actions performed by, 1
adding object-oriented extensions, xvii
case conversion, 257
clauses, 133-144
commercial development of, xii-xvi
comparison operators, 15-18
core functionality of, xxi
data conversion, 13
datatypes, 6-11
evolution of, xvi-xix
functions (see SQL functions)
Java and, xviii
key aspects of, x
language standardization, xix-xxiii
logical operators, 18
naming requirements in, 3
origins of, ix
relational operators, 14-20
resources, 361-364
set operators, 19
shortcomings of, xi
Trace facility (see Trace facility, SQL)
vs. QUEL, xiii
XML and, xviii
SQL functions, 145-203
aggregate, 146-153
character, 162-174
conversion, 182-190
date, 174-181
numeric, 153-162
SQL statements, x, 1-3
alphabetical listing of, 25-31
auditing
setting up, 46
stopping, 102
components of, 20-24
condition component, 23
DDL (Data Definition Language), 32-105
DELETE, 21
DML (Data Manipulation Language), 106-132
errors generated by, 237
executing, 325-334
explaining execution plans, 119
INSERT, 21
phases of statement execution, 343
in PL/SQL programs, 288-293
SELECT, 20
special characters used in, 2
special-purpose data elements, 11-13
syntax
for DDL, 38-105
for DML, 107-132
for schema objects, 5
for SQL clauses, 133-144
target component, 21
tkprof output, interpreting, 342-345
Trace facility, 334-345
tuning, 324-360
EXPLAIN PLAN statement and, 325-334
optimizer hints, 352-355
query performance, 351-360
SET AUTOTRACE command and, 345-349
SET TIMING command and, 349
TIMING command and, 350
UPDATE, 21
SQL-1999 standard, xxi-xxiii
SQL-86 standard, xx
SQL-89 standard, xxi
SQL-92 standard, xx
compliance levels, xxvi
FLAGGER command and, 248
SQLBLANKLINES command (SQL*Plus), 256
SQLCASE command (SQL*Plus), 257
SQLCODE function (PL/SQL), 301
SQLCONTINUE command (SQL*Plus), 257
SQL/DS, xiii
SQLERRM function (PL/SQL), 301
SQL/Foundation, xxi
SQLNUMBER command (SQL*Plus), 257
SQL*Plus, 204-261
buffer, editing the, 208-211
command-line syntax, 204-207
commands
disabled by restriction levels, 206
separating, 244
editing the current line, 208-211
executable name for, 207
formatting output, 211-221
invoking, 207
SET AUTOTRACE command, 345-349
SET TIMING command, 349
system variables, 241-261
TIMING command, 350
user variable commands, 238-241
SQLPREFIX command (SQL*Plus), 257
SQLPROMPT command (SQL*Plus), 258
SQLTERMINATOR command (SQL*Plus), 258
SQRT function, 160
SQUARE (Specifying Queries as Relational Expressions), ix
standards, SQL, xix-xxiii, xxvi, 248
STAR hint, 358
START command (SQL*Plus), 233
STAR_TRANSFORMATION hint, 358
STARTUP command (SQL*Plus), 234
statistics
associating, 44
collecting/deleting, 116
disassociating, 99
displayed by SET AUTOTRACE, 345
improving query performance, 351
timed, 335, 343
STDDEV function, 152
Stonebreaker, Michael, viii, xiii
STOPKEY option (EXPLAIN PLAN), 332
storage parameters and LOB data, 137-139
Storage_Clause, 142
STORAGE_ERROR exception (PL/SQL), 299
STORE command (SQL*Plus), 235
STRING datatype (PL/SQL), 268
subprograms, PL/SQL (see PL/SQL, blocks, functions/procedures)
substitution variables, prefixing, 246
SUBSTR function, 171
SUBSTRB function, 172
SUFFIX command (SQL*Plus), 258
SUM function, 152
Sybase, xv
synonyms
creating, 84
removing, 84
renaming, 103
syntax
common clauses, 133-144
for DDL statements, 38-105
for DML statements, 107-132
for PL/SQL, 262-323
for schema objects, 5
for SQL clauses, 133-144
for SQL functions, 145-203
for SQL*Plus, 204-261
SYS_CONTEXT function, 197-200
SYSDATE function, 181
SYSDATE pseudo-column, 13
SYS_GUID function, 201
system privileges
granting, 101
revoking, 104
System R group, ix-xiv
system variables, SQL*Plus, 241-261
T[ Top ]
TAB command (SQL*Plus), 258
TABLE ACCESS operation (EXPLAIN PLAN), 333
Table_Constraint_Clause, 143
tables
changing, 85-91
creating, 85-91
defining constraints on, 143
deleting rows from, 117
index-by, 271-275
inserting rows into, 120
operations on, 21-23
removing, 85-91
removing rows from, 129
renaming, 103
retrieving data from, 122-126
updating data in, 130-132
tablespaces
allocating storage in, 142
changing, 92-94
creating, 92-94
performing recovery operations on, 228-230
removing, 92-94
temporary, 94
TAN function, 161
Tandem, xv
TANH function, 161
target component of SQL statements, 21
temporary tablespaces, 94
Teradata parallel query machine, xiv
TERMOUT command (SQL*Plus), 259
TIME command (SQL*Plus), 259
time zones, converting from/to, 176
timed statistics, 335, 343
TIMED_STATISTICS parameter, 335
TIMEOUT_ON_RESOURCE exception (PL/SQL), 299
timers, starting/stopping, 350
times, returning current, 181
TIMING command, 350
TIMING command (SQL*Plus), 236, 259
titles, formatting (see BTITLE/TTITLE commands)
tkprof utility, 339-345
formatting trace output, 339-341
interpreting the output file, 342-345
sort options, 340
syntax of, 339-341
what to look for in trace files, 344
TO_CHAR function, 14
converting dates to character strings, 184
converting numbers to character strings, 185-187
TO_DATE function, 10, 14, 187
TO_LOB function, 188
TO_MULTI_BYTE function, 188
TO_NUMBER function, 14, 188
TOO_MANY_ROWS exception (PL/SQL), 299
TO_SINGLE_BYTE function, 189
Trace facility, SQL, 334-345
disabling/enabling, 336-338
initialization parameters, setting, 335
statistic descriptions, 343
tkprof utility (see tkprof utility)
trace files
finding, 338
limiting size of, 336-338
what to look for in, 344
trace output, formatting, 339-345
trace reports, displaying, 243
trailing blanks, controlling, 259
Transaction Processing Performance Council (TPC), xv
TRANSACTION_BACKED_OUT exception (PL/SQL), 299
transactions
SAVEPOINT statement and, 122
setting permissions for, 128
TRANSLATE function, 172
TRANSLATE USING function, 190
triggers, PL/SQL, 318-323
trigonometric functions, 153-162
TRIM function, 173
TRIM method (PL/SQL), variable-sized arrays, 277
TRIMOUT command (SQL*Plus), 259
TRIMSPOOL command (SQL*Plus), 260
TRUNC function, 161, 181
TRUNCATE statement, 31
DML tasks, 107
syntax of, 129
TTITLE command (SQL*Plus)
controlling, 220
defining, 220
displaying, 221
tuning SQL statements (see SQL statements, tuning)
TYPE statement (PL/SQL)
index-by tables, declaring, 271
records, declaring, 269
variable-sized arrays, declaring, 275
types, data (see datatypes)
U[ Top ]
UID function, 201
UNDEFINE command (SQL*Plus), 240
UNDERLINE command (SQL*Plus), 260
UNION ALL set operator, 19
UNION operation (EXPLAIN PLAN), 334
UNION set operator, 19
UNIQUE option (EXPLAIN PLAN), 332, 333
UPDATE statement, 21, 31
DML tasks, 106
in PL/SQL programs, 291
syntax of, 130-132
trigger events and, 318-321
UPPER function, 174
UROWID datatype
Oracle, 11
PL/SQL, 268
USE_CONCAT hint, 357
USE_HASH hint, 359
USE_MERGE hint, 359
USE_NL hint, 359
User Friendly Interface (UFI) (see SQL*Plus)
USER function, 201
USER pseudo-column, 13
user variable commands, SQL*Plus, 238-241
user-defined exceptions, PL/SQL, 299
USER_DUMP_DEST directory, 338
USER_DUMP_DEST parameter, 336
USERENV function, 202
USERENV namespace attributes, 198-200
username keyword (SQL*Plus), 206
users
changing, 95-97
creating, 95-97
removing, 95-97
utlxplan.sql script, 326
V[ Top ]
VALUE_ERROR exception (PL/SQL), 299
VARCHAR datatype (PL/SQL), 268
VARCHAR2 datatype
Oracle, 7
PL/SQL, 268
VARIABLE command (SQL*Plus), 240
variables
PL/SQL
assignment statements, 281
datatypes, 267-268
declaring, 265-268
expressions, 281
implementing global, 313
index-by tables and, 271-275
record types and, 269-271
scope of, 268
SQL, 2
SQL*Plus
system, 241-261
user, 238-241
variable-sized arrays, 275-277
VARIANCE function, 152
VARRAYs, 275-277
VERIFY command (SQL*Plus), 261
VIEW operation (EXPLAIN PLAN), 334
views
changing, 97-99
creating, 97-99
deleting rows from, 117
inserting rows into, 120
joins and, 22
operations on, 21-23
removing, 97-99
renaming, 103
retrieving data from, 122-126
updating data in, 130-132
VSIZE function, 203
W[ Top ]
web sites, Oracle, 363
WHENEVER OSERROR command (SQL*Plus), 236
WHENEVER SQLERROR command (SQL*Plus), 237
WHERE clause, 23
WHILE loop (PL/SQL), 285
whitespace, formatting, 258
WRAP command (SQL*Plus), 261
Z[ Top ]
ZERO_DIVIDE exception (PL/SQL), 299
Return to Oracle SQL: the Essential Reference