contents

Published on March 2017 | Categories: Documents | Downloads: 74 | Comments: 0 | Views: 406
of 36
Download PDF   Embed   Report

Comments

Content

Oracle8™ Bible

Oracle8 Bible


Carol McCullough-Dieter
with contributions by Jatinder Prem,
Ramesh Chandak, and Purshottam Chandak

IDG Books Worldwide, Inc.
An International Data Group Company
Foster City, CA ✦ Chicago, IL ✦ Indianapolis, IN ✦ New York, NY

Oracle8™ Bible
Published by
IDG Books Worldwide, Inc.
An International Data Group Company
919 E. Hillsdale Blvd., Suite 400
Foster City, CA 94404
www.idgbooks.com (IDG Books Worldwide Web site)
Copyright  1998 IDG Books Worldwide. All rights reserved. No part of this book, including interior design, cover
design, and icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying,
recording, or otherwise) without the prior written permission of the publisher.
Library of Congress Catalog Card No.: 98-70265
ISBN: 0-7645-3198-0
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
1B/SX/QV/ZY/FC
Distributed in the United States by IDG Books Worldwide, Inc.
Distributed by Macmillan Canada for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG
Norge Books for Norway; by IDG Sweden Books for Sweden; by Woodslane Pty. Ltd. for Australia; by Woodslane (NZ)
Ltd. for New Zealand; by Addison Wesley Longman Singapore Pte Ltd. for Singapore, Malaysia, Thailand, Indonesia,
and Korea; by Norma Comunicaciones S.A. for Colombia; by Intersoft for South Africa; by International Thomson
Publishing for Germany, Austria, and Switzerland; by Toppan Company Ltd. for Japan; by Distribuidora Cuspide for
Argentina; by Livraria Cultura for Brazil; by Ediciencia S.A. for Ecuador; by Ediciones ZETA S.C.R. Ltda. for Peru; by
WS Computer Publishing Corporation, Inc., for the Philippines; by Unalis Corporation for Taiwan; by Contemporanea
de Ediciones for Venezuela; by Computer Book & Magazine Store for Puerto Rico; by Express Computer Distributors
for the Caribbean and West Indies. Authorized Sales Agent: Anthony Rudkin Associates for the Middle East and
North Africa.
For general information on IDG Books Worldwide’s books in the U.S., please call our Consumer Customer Service
department at 800-762-2974. For reseller information, including discounts and premium sales, please call our Reseller
Customer Service department at 800-434-3422.
For information on where to purchase IDG Books Worldwide’s books outside the U.S., please contact our
International Sales department at 650-655-3200 or fax 650-655-3297.
650-655-3021 or fax 650-655-3281.
For sales inquiries and special prices for bulk quantities, please contact our Sales department at 650-655-3200 or
write to the address above.
For information on using IDG Books Worldwide’s books in the classroom or for ordering examination copies, please
contact our Educational Sales department at 800-434-2086.
For press review copies, author interviews, or other publicity information, please contact our Public Relations
department at 650-655-3000 or fax 650-655-3299.
For authorization to photocopy items for corporate, personal, or educational use, please contact Copyright
Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, or fax 978-750-4470.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: AUTHOR AND PUBLISHER HAVE USED THEIR BEST EFFORTS
IN PREPARING THIS BOOK. IDG BOOKS WORLDWIDE, INC., AND AUTHOR MAKE NO REPRESENTATIONS OR
WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND
SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. THERE ARE NO WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS
PARAGRAPH. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN
SALES MATERIALS. THE ACCURACY AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE
OPINIONS STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS,
AND THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL.
NEITHER IDG BOOKS WORLDWIDE, INC., NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY
OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL,
OR OTHER DAMAGES. FULFILLMENT OF EACH COUPON OFFER IS THE RESPONSIBILITY OF THE OFFEROR
Trademarks: All brand names and product names used in this book are trade names, service marks, trademarks, or
registered trademarks of their respective owners. IDG Books Worldwide is not associated with any product or
vendor mentioned in this book.

The IDG Books Worldwide logo is a trademark under exclusive
license to IDG Books Worldwide, Inc.,
from International Data Group, Inc.

Welcome to the world of IDG Books Worldwide.
IDG Books Worldwide, Inc., is a subsidiary of International Data Group, the world’s largest publisher of
computer-related information and the leading global provider of information services on information technology.
IDG was founded more than 25 years ago and now employs more than 8,500 people worldwide. IDG publishes
more than 275 computer publications in over 75 countries (see listing below). More than 60 million people
read one or more IDG publications each month.
Launched in 1990, IDG Books Worldwide is today the #1 publisher of best-selling computer books in the
United States. We are proud to have received eight awards from the Computer Press Association in recognition
of editorial excellence and three from Computer Currents’ First Annual Readers’ Choice Awards. Our bestselling ...For Dummies® series has more than 30 million copies in print with translations in 30 languages. IDG
Books Worldwide, through a joint venture with IDG’s Hi-Tech Beijing, became the first U.S. publisher to
publish a computer book in the People’s Republic of China. In record time, IDG Books Worldwide has become
the first choice for millions of readers around the world who want to learn how to better manage their
businesses.
Our mission is simple: Every one of our books is designed to bring extra value and skill-building instructions
to the reader. Our books are written by experts who understand and care about our readers. The knowledge
base of our editorial staff comes from years of experience in publishing, education, and journalism —
experience we use to produce books for the ’90s. In short, we care about books, so we attract the best people.
We devote special attention to details such as audience, interior design, use of icons, and illustrations. And
because we use an efficient process of authoring, editing, and desktop publishing our books electronically,
we can spend more time ensuring superior content and spend less time on the technicalities of making books.
You can count on our commitment to deliver high-quality books at competitive prices on topics you want
to read about. At IDG Books Worldwide, we continue in the IDG tradition of delivering quality for more than
25 years. You’ll find no better book on a subject than one from IDG Books Worldwide.

John Kilcullen
CEO
IDG Books Worldwide, Inc.

Eighth Annual
Computer Press
Awards
1992

Ninth Annual
Computer Press
Awards
1993

Steven Berkowitz
President and Publisher
IDG Books Worldwide, Inc.

Tenth Annual
Computer Press
Awards
1994

Eleventh Annual
Computer Press
Awards
1995

IDG Books Worldwide, Inc., is a subsidiary of International Data Group, the world’s largest publisher of computer-related information and the leading global provider of information services on information technology. International
Data Group publishes over 275 computer publications in over 75 countries. Sixty million people read one or more International Data Group publications each month. International Data Group’s publications include: ARGENTINA:
Buyer’s Guide, Computerworld Argentina, PC World Argentina; AUSTRALIA: Australian Macworld, Australian PC World, Australian Reseller News, Computerworld, IT Casebook, Network World, Publish, Webmaster; AUSTRIA:
Computerwelt Osterreich, Networks Austria, PC Tip Austria; BANGLADESH: PC World Bangladesh; BELARUS: PC World Belarus; BELGIUM: Data News; BRAZIL: Annuário de Informática, Computerworld, Connections, Macworld,
PC Player, PC World, Publish, Reseller News, Supergamepower; BULGARIA: Computerworld Bulgaria, Network World Bulgaria, PC & MacWorld Bulgaria; CANADA: CIO Canada, Client/Server World, ComputerWorld Canada,
InfoWorld Canada, NetworkWorld Canada, WebWorld; CHILE: Computerworld Chile, PC World Chile; COLOMBIA: Computerworld Colombia, PC World Colombia; COSTA RICA: PC World Centro America; THE CZECH
AND SLOVAK REPUBLICS: Computerworld Czechoslovakia, Macworld Czech Republic, PC World Czechoslovakia; DENMARK: Communications World Danmark, Computerworld Danmark, Macworld Danmark, PC World
Danmark, Techworld Denmark; DOMINICAN REPUBLIC: PC World Republica Dominicana; ECUADOR: PC World Ecuador; EGYPT: Computerworld Middle East, PC World Middle East; EL SALVADOR: PC World Centro
America; FINLAND: MikroPC, Tietoverkko, Tietoviikko; FRANCE: Distributique, Hebdo, Info PC, Le Monde Informatique, Macworld, Reseaux & Telecoms, WebMaster France; GERMANY: Computer Partner, Computerwoche,
Computerwoche Extra, Computerwoche FOCUS, Global Online, Macwelt, PC Welt; GREECE: Amiga Computing, GamePro Greece, Multimedia World; GUATEMALA: PC World Centro America; HONDURAS: PC World Centro
America; HONG KONG: Computerworld Hong Kong, PC World Hong Kong, Publish in Asia; HUNGARY: ABCD CD-ROM, Computerworld Szamitastechnika, Internetto online Magazine, PC World Hungary, PC-X Magazin Hungary;
ICELAND: Tolvuheimur PC World Island; INDIA: Information Communications World, Information Systems Computerworld, PC World India, Publish in Asia; INDONESIA: InfoKomputer PC World, Komputek Computerworld,
Publish in Asia; IRELAND: ComputerScope, PC Live!; ISRAEL: Macworld Israel, People & Computers/Computerworld; ITALY: Computerworld Italia, Macworld Italia, Networking Italia, PC World Italia; JAPAN: DTP World,
Macworld Japan, Nikkei Personal Computing, OS/2 World Japan, SunWorld Japan, Windows NT World, Windows World Japan; KENYA: PC World East African; KOREA: Hi-Tech Information, Macworld Korea, PC World Korea;
MACEDONIA: PC World Macedonia; MALAYSIA: Computerworld Malaysia, PC World Malaysia, Publish in Asia; MALTA: PC World Malta; MEXICO: Computerworld Mexico, PC World Mexico; MYANMAR: PC World Myanmar;
NETHERLANDS: Computer! Totaal, LAN Internetworking Magazine, LAN World Buyers Guide, Macworld Netherlands, Net, WebWereld; NEW ZEALAND: Absolute Beginners Guide and Plain & Simple Series, Computer Buyer,
Computer Industry Directory, Computerworld New Zealand, MTB, Network World, PC World New Zealand; NICARAGUA: PC World Centro America; NORWAY: Computerworld Norge, CW Rapport, Datamagasinet, Financial
Rapport, Kursguide Norge, Macworld Norge, Multimediaworld Norge, PC World Ekspress Norge, PC World Nettverk, PC World Norge, PC World ProduktGuide Norge; PAKISTAN: Computerworld Pakistan; PANAMA: PC World
Panama; PEOPLE’S REPUBLIC OF CHINA: China Computer Users, China Computerworld, China InfoWorld, China Telecom World Weekly, Computer & Communication, Electronic Design China, Electronics Today, Electronics
Weekly, Game Software, PC World China, Popular Computer Week, Software Weekly, Software World, Telecom World; PERU: Computerworld Peru, PC World Profesional Peru, PC World SoHo Peru; PHILIPPINES: Click!,
Computerworld Philippines, PC World Philippines, Publish in Asia; POLAND: Computerworld Poland, Computerworld Special Report Poland, Cyber, Macworld Poland, Networld Poland, PC World Komputer; PORTUGAL:
Cerebro/PC World, Computerworld/Correio Informático, Dealer World Portugal, Mac*In/PC*In Portugal, Multimedia World; PUERTO RICO: PC World Puerto Rico; ROMANIA: Computerworld Romania, PC World Romania,
Telecom Romania; RUSSIA: Computerworld Russia, Mir PK, Publish, Seti; SINGAPORE: Computerworld Singapore, PC World Singapore, Publish in Asia; SLOVENIA: Monitor; SOUTH AFRICA: Computing SA, Network World
SA, Software World SA; SPAIN: Communicaciones World España, Computerworld España, Dealer World España, Macworld España, PC World España; SRI LANKA: Infolink PC World; SWEDEN: CAP&Design, Computer Sweden,
Corporate Computing Sweden, Internetworld Sweden, it.branschen, Macworld Sweden, MaxiData Sweden, MikroDatorn, Nätverk & Kommunikation, PC World Sweden, PCaktiv, Windows World Sweden; SWITZERLAND:
Computerworld Schweiz, Macworld Schweiz, PCtip; TAIWAN: Computerworld Taiwan, Macworld Taiwan, NEW ViSiON/Publish, PC World Taiwan, Windows World Taiwan; THAILAND: Publish in Asia, Thai Computerworld;
TURKEY: Computerworld Turkiye, Macworld Turkiye, Network World Turkiye, PC World Turkiye; UKRAINE: Computerworld Kiev, Multimedia World Ukraine, PC World Ukraine; UNITED KINGDOM: Acorn User UK, Amiga
Action UK, Amiga Computing UK, Apple Talk UK, Computing, Macworld, Parents and Computers UK, PC Advisor, PC Home, PSX Pro, The WEB; UNITED STATES: Cable in the Classroom, CIO Magazine, Computerworld, DOS
World, Federal Computer Week, GamePro Magazine, InfoWorld, I-Way, Macworld, Network World, PC Games, PC World, Publish, Video Event, THE WEB Magazine, and WebMaster; online webzines: JavaWorld, NetscapeWorld,
and SunWorld Online; URUGUAY: InfoWorld Uruguay; VENEZUELA: Computerworld Venezuela, PC World Venezuela; and VIETNAM: PC World Vietnam.
3/24/97

Credits
Acquisitions Editor
John Osborn
Development Editor
Barbra Guerra
Technical Editors
Ramesh Chandak
Purshottam Chandak
Sue Jang
Piroz Mohseni
Copy Editor
Eric Hahn
Project Coordinator
Susan Parini
Cover Design
Murder By Design

Graphics and Production Specialists
Mario Amador
Stephanie Hollier
Jude Levinson
Elizabeth A. Pauw
Graphics Technicians
Linda Marousek
Hector Mendoza
Quality Control Specialists
Mick Arellano
Mark Schumann
Illustrator
Donna Reynolds
Proofreader
Jennifer K. Overmyer
Indexer
Nancy Anderman Guenther

About the Author
Carol McCullough-Dieter is database administrator for the Pacific Disaster Center
on Maui, Hawaii. This is her fourth book on Oracle. Carol has worked as a systems
designer and consultant for 13 years, specializing in Oracle. She designed a series
of training courses on SQL programming, tuning SQL applications, and designing
Oracle Forms applications.
Carol’s other books (all published by IDG Books Worldwide) include Oracle8 For
Dummies, Oracle7 For Dummies, and Creating Cool Web Databases.
Surf the Web to Carol’s personal Web site, which wins awards for originality, at:
www.maui.net/~mcculc

Carol can be reached by e-mail at [email protected].

About the contributing authors
Ramesh Chandak, graduated with a fellowship in advanced engineering study from
MIT and has a total of eight years of work experience in the IT industry. He has
worked extensively with Internet, Microsoft, Sybase, Powersoft, and Java
technologies. In addition, Ramesh has authored 7 books, tech edited 12 books, and
published over 20 technical articles for several leading publishers on client/server,
database, multimedia, and Internet technologies.
Purshottam Chandak, a Windows application developer and writer, has five years
experience in designing and developing client/server and Web applications. Having
worked extensively with Microsoft, Powersoft, Oracle, and Internet technologies,
he has experience developing corporate applications and products for niche
markets. In addition, Purshottam coauthored a book on Microsoft tools and
technologies, and published an article on distributed PowerBuilder application
development.
Jatinder Prem, or Prem, as he likes to be called, is the founder of ObjectMind
International, an international database consulting company. He splits his time
between writing custom training courses and consulting. He loves to travel and
experience the varied cultures of the world, Bora Bora being the next target in his
travel diary. Prem can be reached at [email protected].

To my husband, Pat, who helps me remember to watch the sunset often enough to
enjoy living in paradise.

Preface

I

am proud to present the finest collection of Oracle8 information you can find
under one cover. Whether you are a brand new Oracle developer or a seasoned
database administrator, you’ll find plenty to sink your teeth into here.

Organization of the Book
The book is divided into five parts. Part I gives you a thorough overview of the
Oracle8 Enterprise Server package and shows you how to use the most popular
tools.
Part II is written tutorial style and shows you how to create database structures,
Tables, Users, Roles, and more. Query and report-writing techniques are also
covered in Part II.
Part III describes detailed scenarios for backing up and restoring your database.
Part III also shows important techniques for monitoring and improving
performance.
Part IV introduces advanced programming methods and complex architecture
schemes, such as clustered Tables and distributed databases.
Part V contains an alphabetical listing of SQL commands, functions, and terms.
Part V also contains detailed reference material on sample Tables, programs, and
information about the CD-ROM.
The CD-ROM in the back of this book contains sample Tables and Objects you
can install on your own Oracle8 database. Once installed, many of the sample
programs can be run. These samples are also found on the CD-ROM.

x

Oracle8 Bible

Icons Explained
Icons are used throughout the book to help you zoom in quickly on important
information.

Icons in the main chapters only
These icons are found in the main chapters (Chapters 1 through 25) and are not
found in the Command Reference section of the book. The icons have many
different meanings, as explained in the following.
CrossReference
See
Reference
Section

Cross-references to another chapter where further explanation of the subject can
be found.
The SQL command listed next to this icon shows you what to look up in the
reference section of the book. The Reference section is arranged alphabetically.

Tip

This icon describes inside information on designing good database systems and
about using Oracle8 wisely.

Note

Watch for extra hints or caveats listed with the Note Icon. The information is not
critical, but it is useful.

On the
CD-ROM

The code found near this icon can be found on the CD-ROM included in the book.

Caution

Beware of pitfalls and code that can be destructive if it isn’t used carefully. This
icon signals you to take extra precautions and to read carefully.
The following icons refer to the tools found in the Enterprise Manager toolset.
They appear in the main chapters when an example or a set of how-to steps use
the tool. Within the Reference section, the icon tells you you can use the tool
shown instead of writing the command in SQL.

Preface

The Schema Manager creates Tables, Indexes, Constraints, and more.

Use the Security Manager tool to create new Users, Profiles, and Roles.

The SQL Worksheet is a window-based tool for writing and executing SQL and
PL/SQL commands.
SQL*Plus is a command environment for writing and executing SQL and PL/SQL.
SQL*Plus can also be used to format reports and it is part of both the client and
the server Packages of Oracle8.
The Storage Manager tool helps create new datafiles and Tablespaces for the
database.
The Instance Manager tool shows you who is logged in to the database.
These icons appear only in the Reference section to help you determine how to
use the commands.
Beginner

Each command in the Command Reference section has been rated as beginner-,
intermediate-, or advanced-level commands. Beginner commands have this icon
and can be used relatively easily by a beginning programmer.

Intermediate Intermediate-level commands require more knowledge than beginner-level

commands. Beginners may need to study the examples carefully before using
these kinds of commands.
Advanced

Advanced-level commands usually require experience with SQL and possibly with
PL/SQL. These commands have more difficult syntax or are useful in limited,
expert-oriented SQL commands.
This icon indicates the command is a part of PL/SQL or is used primarily in PL/SQL
programs.
This icon tells you the command can be used in a C++ program and is primarily
used in this way.

xi

xii

Oracle8 Bible

Summary
Oracle8 Bible has step-by-step tutorials for a full range of tasks that the Oracle8
database administrator and database designer can use. In addition, it has a
complete Command Reference section showing syntax and examples of hundreds
of SQL, PL/SQL, and SQL*Plus commands.
This book is a desktop reference for Oracle8 users of all skill levels. Dozens of
examples throughout the book illustrate concepts and clarify details. With this
book in hand, readers have a wealth of knowledge at their fingertips.
As an added bonus, the CD-ROM contains a complete electronic copy of the full
text of the book, plus sample programs and scripts.

Acknowledgments

M

any thanks to my coauthors, whose contributions made this book
possible. And thanks to the great staff at IDG Books Worldwide, especially
Barbra Guerra and John Osborn.
I wish to thank my family for their patience and my coworkers at Pacific Disaster
Center for their supportive attitudes. A special thanks to Susan, my sister-in-law,
who brightens our home with her loving presence.
Carol McCullough-Dieter

First and foremost, I would like to thank Carol McCullough-Dieter for giving me this
opportunity. My lifeline to Oracle information was Mike Welsh. I would like to
thank Amy Chandi for her excellent technical input. I also want to thank Graham
Welland for his invaluable technical contributions and direction. I thank my friends
at Cornerstone Integrated Services and SMART Technologies, Inc., in Austin, for
understanding my venture into writing. And finally, I wish to thank my family for
believing in my dreams and aspirations.
Jatinder Prem
I would like to thank Carol McCullough-Dieter for giving me the opportunity to be
part of this book. I would also like to thank my wife Kavita for her endless patience
and understanding in keeping me focused and supporting my writing efforts.
Finally, I want to thank my parents, Manoharlal and Padmavati Chandak, my
brothers and sisters-in-law, Purshottam and Padmini Chandak, Pravin, and Neeta
Chandak, my Masi-Masaji Shriniwas and Leelavati Chandak, and my Jiji-Jijaji
(Shriniwas and Pramodini Soni, Satyanarayan, and Prafulla Bihani for their neverending love, support, and patience.
Ramesh Chandak
I want to thank Carol McCullough-Dieter for giving me the opportunity to be part of
this book. I would also like to thank my brother Ramesh for his assistance with the
book. I would also like to express my appreciation to my parents, Manoharlal and
Padmavati Chandak.
Purshottam Chandak

Contents at a Glance
Part 1: Getting Started........................................................................................1
Chapter 1 Introducing Oracle8 ........................................................................................3
Chapter 2 Oracle8 Overview ..........................................................................................25
Chapter 3 Concepts..........................................................................................................43
Chapter 4 Primary Tools ................................................................................................51
Chapter 5 Other Utilities and Tools ............................................................................101

Part II: Nuts and Bolts....................................................................................121
Chapter 6 Security Manager for Users, Roles, and Profiles......................................123
Chapter 7 Schema Manager for Tables........................................................................147
Chapter 8 Schema Manager for Views, Synonyms, and Sequences ........................187
Chapter 9 SQL for Queries ............................................................................................203
Chapter 10 SQL for Data Manipulation........................................................................225
Chapter 11 SQL for Users, Roles, and Security ..........................................................235
Chapter 12 SQL for Tables ............................................................................................247
Chapter 13 Structured Query Language for Views, Synonyms, and Sequences....267
Chapter 14 SQL*Plus for Reports ................................................................................277

Part III: Tuning and backups ........................................................................293
Chapter 15 Performance................................................................................................295
Chapter 16 Oracle8 Backup ..........................................................................................313
Chapter 17 Oracle8 Recovery ......................................................................................389

Part VI: Advanced Topics ..............................................................................441
Chapter 18 Procedural Language for Structured Query Language..........................443
Chapter 19 Procedures, Packages, Functions, and Triggers ....................................461
Chapter 20 Auditing ......................................................................................................503
Chapter 21 Multiple Database Instances ....................................................................519
Chapter 22 Oracle8 Clusters ........................................................................................555
Chapter 23 Very Large Databases ................................................................................569
Chapter 24 Oracle8 Objects ..........................................................................................599
Chapter 25 Programming with Objects ......................................................................647

Part V: Appendixes ........................................................................................663
Appendix A Command Reference ................................................................................665
Appendix B About the CD-ROM..................................................................................1079
Appendix C Sample PL/SQL ........................................................................................1087
Glossary ........................................................................................................................1089
Index ......................................................................................................................................

Table of Contents
Part 1: Getting Started
Chapter 1: Introducing Oracle8........................................................................3
New Features of Oracle8 ..........................................................................................3
Very large database support .........................................................................3
Object-oriented support.................................................................................4
Enhanced Toolset............................................................................................5
A Quick Tour of Oracle8...........................................................................................6
First stop: Instance Manager .........................................................................6
Second stop: Schema Manager .....................................................................8
Third stop: Storage Manager .......................................................................10
Final stop: SQL Worksheet ...........................................................................12
Before You Install ....................................................................................................14
Client or server or both ...............................................................................16
Fresh installation or migration from Version 7 .........................................18
Upgrade from earlier Oracle8 versions......................................................18
Initial Basic Database Contents ............................................................................19
Users ...............................................................................................................19
Roles ...............................................................................................................20
Tables..............................................................................................................21
Oracle8 Bible’s sample Tables.....................................................................21
Summary ..................................................................................................................22

Chapter 2: Oracle8 Overview..........................................................................25
Oracle8 — The Client and Server Relationship...................................................25
Oracle8’s server Package .............................................................................25
Oracle8’s client Package...............................................................................27
Enterprise Manager, the newest star..........................................................28
Starting Oracle8 ......................................................................................................30
Starting the database remotely ...................................................................30
Starting the database on the server...........................................................30
Initializing the Enterprise Manager ......................................................................31
Using the Administrator Toolbar ................................................................33
Getting Help in Oracle8 Documentation..............................................................35
Shutting Down Oracle8 ..........................................................................................37
Shutting down Oracle8 remotely ................................................................37
Shutting down Oracle8 on the server ........................................................39
Summary ..................................................................................................................41

xviii

Oracle8 Bible

Chapter 3: Concepts..........................................................................................43
Security ....................................................................................................................43
Users ...............................................................................................................43
Roles ...............................................................................................................44
Privileges ........................................................................................................44
Profiles ............................................................................................................44
Oracle8 default security ...............................................................................45
Space.........................................................................................................................46
Performance ............................................................................................................47
Backup and Recovery ............................................................................................48
Object-Relational Concepts ...................................................................................49
Summary ..................................................................................................................50

Chapter 4: Primary Tools ................................................................................51
The Enterprise Manager ........................................................................................51
The Enterprise Manager console ................................................................52
Enterprise Manager common tool components .......................................63
Special components of SQL Worksheet .....................................................67
SQL*Plus — the Old Standby.................................................................................69
Pro*C and Other Compilers ..................................................................................70
What is an Oracle8 precompiler?................................................................70
Precompilers and embedded SQL ..............................................................73
What precompilers have to offer the developer ......................................75
Database Engine Programs....................................................................................76
Oracle8 Database Engine .............................................................................76
Net8...........................................................................................................................82
What is Net8? .................................................................................................83
Net8 and the lifecycle of a database request ............................................83
Net8 architecture ..........................................................................................86
Summary ..................................................................................................................99

Chapter 5: Other Utilities and Tools ..........................................................101
Storage Manager ...................................................................................................101
Instance Manager..................................................................................................105
Replication Manager.............................................................................................106
Migration Assistant for Access ...........................................................................112
Data Migration Assistant......................................................................................113
Web Publishing Assistant ....................................................................................114
Database Assistant ...............................................................................................115
File Packager..........................................................................................................116
Performance Monitor ...........................................................................................117
ConText Cartridge and Workbench ....................................................................117
Video Cartridge .....................................................................................................118
Spatial Cartridge and Spatial Cartridge Utilities ..............................................118

Contents

Image Cartridge.....................................................................................................119
Time Series Cartridge...........................................................................................119
Summary ................................................................................................................120

Part II: Nuts and Bolts
Chapter 6: Security Manager for Users, Roles, and Profiles ................123
Users .......................................................................................................................124
Creating a new User....................................................................................124
Changing a User’s password......................................................................128
Adding Roles or privileges to Users .........................................................129
Removing Roles or privileges from Users................................................131
Changing a User’s default Tablespaces, account lock, profile, or quota...
132
Switching Users or databases in Security Manager ...............................133
Roles .......................................................................................................................134
Creating a new Role ....................................................................................135
Assigning Users to a Role...........................................................................137
Adding and removing Roles or privileges to Roles ................................140
Allowing Object Owners to use Security Manager .................................141
Profiles....................................................................................................................141
Creating a new profile.................................................................................142
Assigning a profile to a User......................................................................143
Managing password features with profile ...............................................145
Summary ................................................................................................................146

Chapter 7: Schema Manager for Tables ....................................................147
Tables .....................................................................................................................147
Defining Columns in Oracle8 .....................................................................147
What is null? ................................................................................................149
Creating a new Table ..................................................................................151
Changing Columns in a Table ....................................................................159
Primary Keys .........................................................................................................171
Creating a new Primary Key ......................................................................172
Changing a Primary Key.............................................................................175
Removing a Primary Key............................................................................176
Foreign Keys ..........................................................................................................176
Adding a Foreign Key..................................................................................176
Changing a Foreign Key..............................................................................178
Removing a Foreign Key.............................................................................180
Indexes ...................................................................................................................180
What is a row ID? ........................................................................................181
The twenty percent rule.............................................................................182
Creating new Indexes on Tables................................................................182

xix

xx

Oracle8 Bible

Changing an Index.......................................................................................184
Removing an Index......................................................................................185
Summary ................................................................................................................186

Chapter 8: Schema Manager for Views, Synonyms, and Sequences..187
Views.......................................................................................................................187
Modifying data using views .......................................................................188
Creating a new view....................................................................................188
Changing a view with Schema Manager...................................................191
Deleting (dropping) a view ........................................................................192
Synonyms...............................................................................................................193
Creating a new Synonym............................................................................195
Deleting (dropping) a Synonym ................................................................197
Sequences ..............................................................................................................197
Creating a new sequence ...........................................................................198
Changing (altering) a sequence ................................................................200
Deleting (dropping) a sequence................................................................201
Summary ................................................................................................................201

Chapter 9: SQL for Queries ..........................................................................203
Selecting Your Tool ...............................................................................................203
How to use SQL Worksheet for queries ...................................................204
How to use SQL*Plus for queries..............................................................206
The Basic SQL Query ...........................................................................................210
Sampling some queries ..............................................................................211
Some tips to help you write good queries...............................................213
Joining Tables........................................................................................................214
Basic join ......................................................................................................214
Examples of join queries ............................................................................215
Outer join .....................................................................................................216
Using subqueries.........................................................................................218
Exists clause ................................................................................................219
SQL Functions in Queries ....................................................................................219
The DECODE function.................................................................................219
The INSTR function .....................................................................................220
The SUBSTR function..................................................................................221
The CONCATENATE symbol ......................................................................222
The NVL function ........................................................................................222
Summary ................................................................................................................223

Chapter 10: SQL for Data Manipulation ....................................................225
Modifying Data in Tables and Views ..................................................................225
Updating Rows ......................................................................................................226
Using literals ................................................................................................226

Contents

Update using subqueries ...........................................................................227
Update using correlated subqueries ........................................................228
Inserting Rows.......................................................................................................230
Inserting with literals..................................................................................230
Inserts using a subquery............................................................................231
Deleting Rows........................................................................................................232
Substituting a Subquery for a Table Name........................................................232
Summary ................................................................................................................233

Chapter 11: SQL for Users, Roles, and Security ......................................235
Users .......................................................................................................................235
Creating a new User....................................................................................235
Changing a User’s password......................................................................237
Adding Roles or privileges to Users .........................................................238
Removing Roles or privileges from Users................................................240
Changing a User’s default Tablespaces, account lock,
profile, or quota......................................................................................241
Switching User or database in SQL...........................................................241
Roles .......................................................................................................................241
Creating a new Role ....................................................................................242
Assigning Users to a Role...........................................................................242
Adding Roles or privileges to Roles .........................................................243
Removing (revoking) Roles or privileges from Roles.............................243
Profiles....................................................................................................................244
Creating a new profile.................................................................................244
Assigning a profile to a User......................................................................245
Managing password features with profile................................................245
Summary ................................................................................................................246

Chapter 12: SQL for Tables............................................................................247
Tables .....................................................................................................................247
Creating a new Table ..................................................................................248
Changing Columns in a Table ....................................................................251
Removing (dropping) a Table....................................................................259
Primary Keys .........................................................................................................259
Creating a new Primary Key ......................................................................260
Changing a Primary Key.............................................................................260
Removing a Primary Key............................................................................261
Foreign Keys ..........................................................................................................261
Adding a Foreign Key..................................................................................261
Changing a Foreign Key..............................................................................262
Removing a Foreign Key.............................................................................262
Indexes ...................................................................................................................263
Creating new Indexes on Tables................................................................264
Changing an Index.......................................................................................265

xxi

xxii

Oracle8 Bible

Removing (dropping) an Index .................................................................265
Summary ................................................................................................................265

Chapter 13: SQL for Views, Synonyms, and Sequences ........................267
Views.......................................................................................................................267
Modifying data using views .......................................................................268
Creating a new view....................................................................................268
Changing a view with SQL..........................................................................270
Deleting (dropping) a View ........................................................................270
Synonyms...............................................................................................................271
Creating a new Synonym............................................................................272
Deleting (dropping) a Synonym ................................................................272
Sequences ..............................................................................................................273
Creating a new sequence ...........................................................................273
Changing (altering) a sequence ................................................................274
Deleting (dropping) a sequence................................................................275
Summary ................................................................................................................275

Chapter 14: SQL*Plus for Reports ..............................................................277
SQL*Plus: A Programming Tool ..........................................................................277
Basic Report Commands .....................................................................................278
COLUMN .......................................................................................................279
TTITLE and BTITLE.....................................................................................281
SPOOL ...........................................................................................................282
Group Functions....................................................................................................282
ORDER BY for sorting results....................................................................282
Group functions (SUM, AVG, and so forth)..............................................283
GROUP BY ....................................................................................................284
BREAK and COMPUTE................................................................................285
Variables and Parameters ....................................................................................287
DEFINE ..........................................................................................................287
Executing reports with @ ...........................................................................288
SET ................................................................................................................289
Report Formatting ................................................................................................290
PAGESIZE and LINESIZE..............................................................................290
TTITLE with SYSDATE ................................................................................290
RECSEP and RECSEPCHAR.........................................................................291
Summary ................................................................................................................292

Part III: Tuning and Backups
Chapter 15: Performance ..............................................................................295
Initialization Parameters......................................................................................295
DB_BLOCK_BUFFERS ..................................................................................296

Contents

SHARED_POOL_SIZE ...................................................................................298
OPTIMIZER_MODE ......................................................................................300
Cost-Based Optimizer...........................................................................................300
ANALYZE.......................................................................................................301
EXPLAIN PLAN.............................................................................................303
Hints..............................................................................................................305
Indexes..........................................................................................................307
NOT ...............................................................................................................309
Summary ................................................................................................................311

Chapter 16: Oracle8 Backup ........................................................................313
Oracle8 Backup .....................................................................................................313
Oracle8 backup elements and concepts..................................................314
Oracle8 Backup Methodologies ..........................................................................322
The Oracle8 Recovery Manager .........................................................................322
Using a Control File with Recovery Manager ..........................................323
Using the Recovery Catalog with Recovery Manager............................324
Recovery Catalog general maintenance...................................................338
Using Recovery Manager ...........................................................................338
Integrity checking........................................................................................343
Using Recovery Manager to backup to tape ...........................................344
Recovery Manager backup operations ....................................................345
Recovery manager maintenance...............................................................363
Export .....................................................................................................................366
Export modes ..............................................................................................367
Starting the Oracle8 Export utility............................................................368
Export paths ................................................................................................373
Full database mode options ......................................................................375
Export error handling.................................................................................376
The Oracle8 NT Backup Manager.......................................................................377
The NOARCHIVELOG mode .......................................................................377
The ARCHIVELOG mode.............................................................................379
Oracle8 Operating System Backups ...................................................................380
Performing Tablespace backups ...............................................................382
Ensuring the Integrity of Backups ......................................................................386
The DB_VERIFY parameter list..................................................................386
DB_VERIFY examples..................................................................................386
Summary ................................................................................................................387

Chapter 17: Oracle8 Recovery......................................................................389
Oracle8 Recovery Data Structures .....................................................................390
Control File...................................................................................................390
Rollback segments ......................................................................................391
Redo records................................................................................................392
The online redo log file ..............................................................................392

xxiii

xxiv

Oracle8 Bible

System change number ..............................................................................393
Datafiles ........................................................................................................394
Checkpoint ...................................................................................................394
Oracle8 Recovery Principles ...............................................................................395
Redo threads................................................................................................395
The stages of an Oracle8 instance startup..............................................396
Oracle8 recovery intelligence....................................................................398
The Oracle8 recovery process ..................................................................399
Oracle8 Failure ......................................................................................................399
Oracle8 recovery analysis..........................................................................400
Instance automatic recovery.....................................................................401
Media (Disk) Recovery.........................................................................................402
Types of media recovery............................................................................403
Guidelines for media recovery ..................................................................403
Restoring a database in NOARCHIVELOG mode.....................................403
Complete recovery......................................................................................404
Performing complete recovery .................................................................405
Performing incomplete media recovery ..................................................408
User or application failure .........................................................................410
Recovery Manager ......................................................................................411
Re-creating damaged database files .........................................................423
NT Recovery Manager ................................................................................426
Import.....................................................................................................................430
Import modes ..............................................................................................431
Starting the Oracle8 Import utility ...........................................................431
Import parameters ......................................................................................433
Importing complete, incremental, and cumulative Export files ...........436
Understanding Table -level and partition-level Imports ........................437
Import error handling.................................................................................438
Summary ................................................................................................................439

Part IV: Advanced Topics
Chapter 18: PL/SQL ........................................................................................443
Writing PL/SQL Code ............................................................................................443
Declared Variables ................................................................................................444
IF-THEN-ELSE .........................................................................................................446
Cursors ...................................................................................................................446
Explicit cursors ...........................................................................................447
Implicit cursor .............................................................................................448
Cursor attributes.........................................................................................449
LOOPS.....................................................................................................................450
CURSOR FOR LOOP.....................................................................................451
Simple LOOP ................................................................................................451

Contents

WHILE LOOP ................................................................................................453
FOR LOOP.....................................................................................................453
HTML Extensions ..................................................................................................454
Handling Errors .....................................................................................................456
Summary ................................................................................................................459

Chapter 19: Procedures, Packages, Functions, and Triggers ................461
Knowledge at Hand for the Journey Ahead ......................................................461
Your Enterprise System and Stored Subprograms...........................................462
Chapter Case Study ..............................................................................................464
Library system workflow ...........................................................................464
Stored Procedures ................................................................................................465
Create Procedure syntax............................................................................467
Maintaining stored Procedures .................................................................471
Performance issues on stored Procedures..............................................471
Functions................................................................................................................472
Creating functions by example..................................................................472
Packages.................................................................................................................474
Creating Packages by example..................................................................474
Package components ..................................................................................477
Executing Packages.....................................................................................479
Benefits of using a Package........................................................................479
Overloading Package interfaces................................................................480
Package session state.................................................................................480
Serially reusable Packages.........................................................................480
Dropping Packages......................................................................................481
Oracle-supplied Packages ..........................................................................481
Subprogram Internals...........................................................................................482
Stored subprogram storage .......................................................................482
Validation of stored subprograms during execution..............................482
Executing a stored subprogram ................................................................483
Stored subprograms dependencies ..........................................................483
Stored subprogram hiding .........................................................................486
Debugging stored subprograms ................................................................487
Listing information about stored subprograms......................................487
Triggers ..................................................................................................................488
When to use Triggers over declarative referential integrity.................488
Creating Triggers by example....................................................................489
Trigger syntax..............................................................................................489
Trigger components....................................................................................489
Restrictions on creating a Trigger ............................................................492
Trigger execution ........................................................................................492
Data access for Triggers.............................................................................494
Trigger maintenance and security............................................................495
Understanding Subprogram Exceptions ............................................................496

xxv

xxvi

Oracle8 Bible

Implementing exceptions ...........................................................................497
Why use exceptions? ..................................................................................497
Handling exceptions ...................................................................................498
Handling unnamed internal exceptions ...................................................499
Summary ................................................................................................................500

Chapter 20: Auditing ......................................................................................503
Oracle8 Auditing Concepts..................................................................................503
Why audit a database? ...............................................................................503
Auditing options offered by Oracle8 ........................................................504
Implementing Oracle8 Auditing ..........................................................................508
Enabling Oracle8 auditing..........................................................................508
Enabling and disabling auditing options .................................................508
The Oracle8 Audit Trail........................................................................................510
Using Triggers to Audit Database Operations ..................................................514
Setting up Trigger auditing ........................................................................514
Summary ................................................................................................................517

Chapter 21: Multiple Database Instances ................................................519
The Oracle8 Instance............................................................................................519
Oracle8 Instance Applications ............................................................................520
Single instance database systems ............................................................521
Multi-instance database system................................................................521
Oracle8 distributed database system ......................................................523
Oracle8 Parallel Server Application ...................................................................524
An overview of the Parallel Server application ......................................524
Attributes of a Parallel Server application ..............................................526
Designing an Oracle8 parallel server system..........................................528
Implementing and administrating an Oracle8 Parallel Server ..............532
Parallel server concepts ............................................................................536
The benefits of an Oracle8 Parallel Server ..............................................539
The traps of an Oracle8 Parallel Server system .....................................541
Distributed Database Application ......................................................................541
Heterogeneous Oracle8 distributed database systems .........................542
Developing distributed database systems ..............................................542
Administrating an Oracle8 distributed database system......................545
Understanding distributed transaction management ............................549
The Oracle8 session trees..........................................................................550
Summary ................................................................................................................552

Chapter 22: Oracle8 Clusters........................................................................555
Clusters ..................................................................................................................555
Creating clusters, cluster Tables, and cluster Indexes ..........................556
Guidelines in creating clusters..................................................................560

Contents

Managing cluster Schema Objects............................................................564
Gathering information on clusters............................................................567
Summary ................................................................................................................568

Chapter 23: Very Large Databases ..............................................................569
Very Large Databases ...........................................................................................569
Database Object Partitioning ..............................................................................570
Advantages of using Oracle8 partitions...................................................571
Large Object Datatypes ..............................................................................582
Initializing internal LOBs............................................................................587
Manipulating LOBs......................................................................................588
Summary ................................................................................................................597

Chapter 24: Oracle8 Objects ........................................................................599
Introduction to Oracle8 Object Technology .....................................................599
Object-Relational Oracle8 ....................................................................................601
Advantages of Object-relational Oracle8 .................................................603
Disadvantages of Object-relational Oracle8 ............................................603
An Object-Relational Case Study ........................................................................603
Library system processes..........................................................................604
Library example Tables..............................................................................605
Library example entities ............................................................................605
Oracle8 Objects.....................................................................................................606
Object types.................................................................................................606
Collection types...........................................................................................618
Oracle8 Object Tables ................................................................................623
Finalizing the library system example .....................................................628
Manipulating Object Tables .......................................................................633
Oracle8 Object Views ...........................................................................................638
Creating Object view concepts .................................................................639
Creating Object views by example ...........................................................640
Updating Object views ...............................................................................643
Summary ................................................................................................................646

Chapter 25: Programming with Objects ....................................................647
Reviewing the Sample Object Tables .................................................................647
PL/SQL with Oracle8 Objects ..............................................................................649
Querying Object Tables..............................................................................649
List a person’s loaned books.....................................................................651
Updating a nested Table.............................................................................654
Inserting into a nested Table .....................................................................656
Deleting from a nested Table.....................................................................658
JDBC with Oracle8 Objects..................................................................................660
List a person’s loaned books.....................................................................660

xxvii

xxviii

Oracle8 Bible

Updating a nested Table.............................................................................661
Inserting into a nested Table .....................................................................661
Deleting from a nested Table.....................................................................661
Summary ................................................................................................................661

Part V: Appendixes
Appendix A: Command Reference..............................................................665
%FOUND .................................................................................................................665
%ISOPEN.................................................................................................................667
%NOTFOUND .........................................................................................................669
%ROWCOUNT ........................................................................................................671
%ROWTYPE ...........................................................................................................673
%TYPE ....................................................................................................................675
(+) ...........................................................................................................................677
@ (“at” sign) ...........................................................................................................678
@@ ...........................................................................................................................679
ABS..........................................................................................................................680
ACCEPT ..................................................................................................................681
ACOS .......................................................................................................................682
ADD_MONTHS .......................................................................................................683
ALTER CLUSTER ...................................................................................................684
ALTER DATABASE..................................................................................................686
ALTER FUNCTION..................................................................................................688
ALTER INDEX .........................................................................................................689
ALTER PACKAGE....................................................................................................690
ALTER PROCEDURE ..............................................................................................691
ALTER PROFILE .....................................................................................................692
ALTER RESOURCE COST ......................................................................................694
ALTER ROLE...........................................................................................................696
ALTER ROLLBACK SEGMENT ..............................................................................697
ALTER SEQUENCE .................................................................................................698
ALTER SESSION......................................................................................................700
ALTER SNAPSHOT.................................................................................................702
ALTER SNAPSHOT LOG ........................................................................................704
ALTER SNAPSHOT LOG ........................................................................................705
ALTER SYSTEM......................................................................................................706
ALTER TABLE .........................................................................................................708
ALTER TABLESPACE..............................................................................................710
ALTER TRIGGER ....................................................................................................711
ALTER TYPE...........................................................................................................712
ALTER USER ...........................................................................................................714
ALTER VIEW ...........................................................................................................716
ANALYZE ................................................................................................................717

Contents

APPEND ..................................................................................................................719
ASCII .....................................................................................................................720
ASIN.........................................................................................................................721
ATAN .......................................................................................................................722
ATAN2 .....................................................................................................................723
AUDIT......................................................................................................................724
AVG..........................................................................................................................725
BFILENAME ............................................................................................................726
BLOCK ....................................................................................................................727
BTITLE ....................................................................................................................729
CEIL .........................................................................................................................731
CHANGE..................................................................................................................732
CHARTOROWID .....................................................................................................733
CHR .........................................................................................................................734
CLEAR .....................................................................................................................735
CLOSE .....................................................................................................................736
COLUMN.................................................................................................................737
COMMENT..............................................................................................................739
COMMIT .................................................................................................................740
COMPUTE...............................................................................................................741
CONCATENATE ......................................................................................................745
CONNECT BY.........................................................................................................747
CONVERT ...............................................................................................................749
COPY.......................................................................................................................751
COS..........................................................................................................................753
COSH.......................................................................................................................754
COUNT....................................................................................................................755
CREATE CLUSTER .................................................................................................756
CREATE CONTROLFILE ........................................................................................758
CREATE DATABASE ...............................................................................................760
CREATE DATABASE LINK......................................................................................762
CREATE PROFILE...................................................................................................764
CREATE DIRECTORY.............................................................................................766
CREATE FUNCTION...............................................................................................767
CREATE INDEX.......................................................................................................769
CREATE LIBRARY ..................................................................................................771
CREATE PACKAGE.................................................................................................772
CREATE PACKAGE BODY .....................................................................................774
CREATE PROCEDURE ...........................................................................................776
CREATE ROLE ........................................................................................................778
CREATE ROLLBACK SEGMENT ...........................................................................779
CREATE SCHEMA...................................................................................................780
CREATE SEQUENCE ..............................................................................................781
CREATE SNAPSHOT ..............................................................................................783
CREATE SNAPSHOT LOG .....................................................................................785
CREATE SYNONYM ...............................................................................................787

xxix

xxx

Oracle8 Bible

CREATE TABLE ......................................................................................................788
CREATE TABLESPACE ...........................................................................................790
CREATE TRIGGER..................................................................................................791
CREATE TYPE ........................................................................................................793
CREATE TYPE BODY.............................................................................................796
CREATE USER ........................................................................................................798
CREATE VIEW ........................................................................................................800
CURRVAL ................................................................................................................802
CURSOR_ALREADY_OPEN ...................................................................................803
DATATYPE ..............................................................................................................804
DATATYPE — CHAR ...............................................................................................806
DATATYPE — DATE................................................................................................807
DATATYPE — FLOAT..............................................................................................808
DATATYPE — LONG...............................................................................................809
DATATYPE — LONGRAW.......................................................................................811
DATATYPE — MLSLABEL ......................................................................................812
DATATYPE — NUMBER .........................................................................................813
DATATYPE — RAW .................................................................................................814
DATATYPE — ROWID.............................................................................................815
DATATYPE — VARCHAR ........................................................................................816
DATATYPE — VARCHAR2 ......................................................................................817
DECLARE ................................................................................................................818
DECODE..................................................................................................................819
DEFINE ....................................................................................................................821
DEL..........................................................................................................................822
DELETE ...................................................................................................................824
DEREF .....................................................................................................................826
DESCRIBE ...............................................................................................................827
DROP CLUSTER .....................................................................................................828
DROP DATABASE LINK .........................................................................................829
DROP DIRECTORY ................................................................................................830
DROP FUNCTION...................................................................................................831
DROP INDEX ..........................................................................................................832
DROP LIBRARY ......................................................................................................833
DROP PACKAGE.....................................................................................................834
DROP PROCEDURE ...............................................................................................835
DROP PROFILE ......................................................................................................836
DROP ROLE............................................................................................................837
DROP ROLLBACK SEGMENT ...............................................................................838
DROP SEQUENCE ..................................................................................................839
DROP SNAPSHOT ..................................................................................................840
DROP SNAPSHOT LOG .........................................................................................841
DROP SYNONYM...................................................................................................842
DROP TABLE ..........................................................................................................843
DROP TABLESPACE...............................................................................................844
DROP TRIGGER......................................................................................................845

Contents

DROP TYPE ............................................................................................................846
DROP TYPE BODY ................................................................................................847
DROP USER ............................................................................................................848
DROP VIEW ............................................................................................................849
DUMP ......................................................................................................................850
DUP_VAL_ON_INDEX ............................................................................................852
EDIT ........................................................................................................................853
EMPTY_BLOB ........................................................................................................854
EMPTY_CLOB ........................................................................................................855
EXCEPTION INIT Pragma .....................................................................................856
EXECUTE ................................................................................................................857
EXISTS.....................................................................................................................858
EXIT.........................................................................................................................859
EXIT.........................................................................................................................860
EXIT-WHEN.............................................................................................................862
EXP..........................................................................................................................863
EXPLAIN PLAN.......................................................................................................864
FETCH .....................................................................................................................866
FLOOR.....................................................................................................................868
FOR-LOOP ..............................................................................................................869
FORMAT..................................................................................................................870
FORMAT — DATE ...................................................................................................871
FORMAT — NUMBER.............................................................................................873
GET..........................................................................................................................875
GLB..........................................................................................................................876
GOTO ......................................................................................................................877
GRANT ....................................................................................................................878
GREATEST ..............................................................................................................880
GREATEST_LB........................................................................................................881
HEXTORAW ............................................................................................................882
HOST.......................................................................................................................883
IF-THEN...................................................................................................................884
IF-THEN-ELSE .........................................................................................................885
IF-THEN-ELSEIF ......................................................................................................886
INITCAP ..................................................................................................................888
INPUT......................................................................................................................889
INSERT ....................................................................................................................890
INSTR ......................................................................................................................892
INSTRB....................................................................................................................894
INTERSECT.............................................................................................................896
INVALID_CURSOR..................................................................................................897
INVALID_NUMBER .................................................................................................898
KEYWORDS ............................................................................................................899
LABELS ...................................................................................................................901
LAST_DAY...............................................................................................................902
LEAST .....................................................................................................................903

xxxi

xxxii

Oracle8 Bible

LEAST_LB ...............................................................................................................904
LENGTH ..................................................................................................................905
LENGTHB................................................................................................................906
LIKE.........................................................................................................................907
LIST .........................................................................................................................909
LN ............................................................................................................................911
LOCK TABLE ..........................................................................................................912
LOG .........................................................................................................................914
LOGIN_DENIED ......................................................................................................915
LOOP.......................................................................................................................916
LOWER....................................................................................................................917
LPAD........................................................................................................................918
LTRIM ......................................................................................................................919
LUB..........................................................................................................................920
MAKE_REF..............................................................................................................921
MAX.........................................................................................................................922
MIN..........................................................................................................................923
MINUS .....................................................................................................................924
MOD ........................................................................................................................925
MONTHS_BETWEEN .............................................................................................926
NEW_TIME .............................................................................................................927
NEXT_DAY..............................................................................................................929
NEXTVAL ...............................................................................................................930
NLS_CHARSET_DECL_LEN...................................................................................931
NLS_CHARSET_ID..................................................................................................932
NLS_CHARSET_NAME...........................................................................................933
NLS_INITCAP .........................................................................................................934
NLS_LOWER...........................................................................................................935
NLS_UPPER ............................................................................................................936
NO_DATA_FOUND .................................................................................................937
NOAUDIT ................................................................................................................938
NOT_LOGGED_ON ................................................................................................940
NULL .......................................................................................................................941
NVL .........................................................................................................................942
OPEN.......................................................................................................................943
OPEN-FOR ..............................................................................................................944
OPERATOR .............................................................................................................945
OPERATOR — <>...................................................................................................946
OPERATOR — > ......................................................................................................947
OPERATOR — >= ....................................................................................................948
OPERATOR — ! = ....................................................................................................949
OPERATOR — * ......................................................................................................950
OPERATOR — + ......................................................................................................951
OPERATOR — - .......................................................................................................952
OPERATOR — /.......................................................................................................953
OPERATOR — < = ...................................................................................................954

Contents

OPERATOR — = ......................................................................................................955
OPERATOR — AND ................................................................................................956
OPERATOR — BETWEEN ......................................................................................957
OPERATOR — IN ....................................................................................................958
OPERATOR — IS NOT NULL .................................................................................959
OPERATOR — IS NULL ..........................................................................................960
OPERATOR — NOT ................................................................................................961
OPERATOR — NOT BETWEEN .............................................................................962
OPERATOR — NOT IN ...........................................................................................963
OPERATOR — OR...................................................................................................964
PRIOR......................................................................................................................965
PROGRAM_ERROR ................................................................................................967
PROMPT .................................................................................................................968
PSEUDOCOLUMN ..................................................................................................969
RAISE.......................................................................................................................970
RAWTOHEX ............................................................................................................971
RECORD..................................................................................................................972
REFTOHEX .............................................................................................................974
REMARK .................................................................................................................975
RENAME .................................................................................................................976
REPFOOTER ...........................................................................................................977
REPHEADER ...........................................................................................................979
REPLACE ................................................................................................................981
REPLACE ................................................................................................................982
RETURN ..................................................................................................................983
REVOKE ..................................................................................................................984
ROLLBACK .............................................................................................................986
ROUND....................................................................................................................987
ROUND....................................................................................................................988
ROWIDTOCHAR.....................................................................................................991
ROWTYPE_MISMATCH .........................................................................................992
RPAD .......................................................................................................................993
RTRIM .....................................................................................................................994
SAVE ........................................................................................................................995
SAVEPOINT ...........................................................................................................996
SELECT ..................................................................................................................997
SELECT INTO .........................................................................................................999
SET ........................................................................................................................1001
SET ROLE .............................................................................................................1004
SET TRANSACTION.............................................................................................1005
SHOW....................................................................................................................1006
SIGN ......................................................................................................................1008
SIN .........................................................................................................................1010
SINH ......................................................................................................................1011
SPOOL...................................................................................................................1014
SQLERRM .............................................................................................................1015
SQLPLUS...............................................................................................................1016
SQRT .....................................................................................................................1017
START ...................................................................................................................1018

xxxiii

xxxiv

Oracle8 Bible

STDDEV ................................................................................................................1019
STORAGE..............................................................................................................1020
STORAGE_ERROR ...............................................................................................1022
STORE...................................................................................................................1023
SUBSTR.................................................................................................................1024
SUBSTRB ..............................................................................................................1025
SUM .......................................................................................................................1027
SYSDATE...............................................................................................................1028
TABLE ...................................................................................................................1029
TAN........................................................................................................................1030
TANH.....................................................................................................................1031
TIMEOUT_ON_RESOURCE .................................................................................1032
TIMING..................................................................................................................1033
TO_CHAR (date)..................................................................................................1034
TO_CHAR (label).................................................................................................1036
TO_CHAR (number)............................................................................................1037
TO_DATE (char) ..................................................................................................1039
TO_LABEL (char) ................................................................................................1041
TO_MULTI_BYTE (char).....................................................................................1042
TO_NUMBER (char)............................................................................................1043
TO_SINGLE_BYTE (char) ...................................................................................1045
TOO_MANY_ROWS .............................................................................................1046
TRANSLATE..........................................................................................................1047
TRUNC (date) ......................................................................................................1049
TRUNC (number) ................................................................................................1050
TRUNCATE ...........................................................................................................1052
TTITLE ..................................................................................................................1053
UID.........................................................................................................................1055
UNDEFINE.............................................................................................................1056
UNION ...................................................................................................................1057
UNION ALL ...........................................................................................................1058
UPDATE ................................................................................................................1059
UPPER ...................................................................................................................1061
USER......................................................................................................................1062
USERENV ..............................................................................................................1063
VALUE_ERROR.....................................................................................................1065
VARIABLE .............................................................................................................1066
VARIABLE ASSIGNMENT.....................................................................................1067
VARIANCE.............................................................................................................1068
VSIZE.....................................................................................................................1069
RESERVED WORDS..............................................................................................1070
WHENEVER OSERROR........................................................................................1072
WHENEVER SQLERROR......................................................................................1074
WHILE-LOOP ........................................................................................................1076
ZERO_DIVIDE .......................................................................................................1077

Contents

Appendix B About the CD-ROM ................................................................1079
Sample Tables and Objects ...............................................................................1079
Example SQL Scripts ..........................................................................................1085
Acrobat Reader ...................................................................................................1086

Appendix C Sample PL/SQL ......................................................................1087
PL/SQL for Relational Tables.............................................................................1087
PL/SQL for Object Tables...................................................................................1087

Glossary ..........................................................................................................1089
Index .............................................................................................................................

xxxv

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close