Oracle 8: The Complete Reference, 1st edition
Authors: George B. Koch, Kevin Loney
Venue:  (1997)

From the Book:ORACLE is the most widely used database in the world. It runs on virutally every kind of computer, from PCs and Macintoshes, to miniicomputers and giant mainframes It functions virtally indentically on all these machines, so when you learn it on one, you can use it on any other. This fact makes knowledgeable ORACLE users and developers very much in demand, and makes your ORACLE knowledge and skills very portable. ORACLE documentation is thououghgoing and voluminous, currently spanning more than 50 volumes. ORACLE8: The Complete Reference is the first entity that has gathered all of the major ORACLE definitions, commands, functions, features, and products together in a single massive core reference - one volume that every ORACLE user and developer can keep handy on his or her desk. The audience for this book will usually fall into one of three catagories: An ORACLE end user - ORACLE can easily be used for simple operations such as entering data and running standard reports But such an approach would ignore its grreat power; it would be like buying a high-performance racing car and then pulling it around with a horse. With the introduction provided in the first sections of this book, even an end user with little or no data processing backround can become a proficient ORACLE user - generating ad hoc, English-language reports, guiding developers in the creation of new features and functions, and improving the speed and accuracy of the real work done in a business. The language of the book is simple, clear English wihtout data processing jargon, and with few assumptions about previous knowledge of computers or databases. It will help beginners to become experts withan easy-to-follow format and numerous real examples. A developer who is new to ORACLE With as many volumes of documentation as ORACLE provides, finding a key command or concept can be a time-consuming effort. This look attempts to provide a more organized and efficient manner of learning the essentials of the product. The format coaches a developer new to ORACLE quickly through the basic concepts, covers areas of common difficulty examines misunderstanding, of the product and relational development, and sets clear guidelines for effective application building. An exprienced ORACLE developer As with any product of great breadth and sophistication, there are important issues about which little, if anything, has been published. Knowledge comes through long experience, but is often not transferred to others. This book delves deeply into many such subject areas (such as precedence in UNION, INTERSECTION, and MINUS operators, usiing SQLPLUS as a code-generator, inheritance and CONNECT BY, eliminating NOT IN With an outer join, using ConText, implementing the object-relational options and many others). The text also reveals many common misconceptions and suggests rigorous guidelines for naming conventions application development techniques, and design and performance issues. For every user and developer, nearly 300 pages of this book are devoted to a comprchensive alphabetical Reference containing all major ORACLE concepts, commands, functions, and features including proper syntax, cross-rererences and examples. This is the largest single reference published on the subject. How This Book Is Organized There are six major parts to this book and a CD-ROM. Part I is is an introduction to "Critical Database Concepts." These chapters are essential reading for any ORACLE user, new or veteran, from key entry clerk to Database Administrator. They establish the common vocabulary that both end users and developers can use to coherently and intelligently share concepts and assure the success of any development effort. This introductory section is intended for both developers and end users of ORACLE. It explores the basic ideas and vocabulary of relational databases and points out the dangers, classical errors, and profound opportunities in relational database applications. Part II, "SQL: Going from Beginner to Expert," teaches the theory and techniques of relational database systems and applications, including SQL (Structured Query Language) and SQLPLUS. The section begins relatively few assumptions about data processing knowledge on the part ot the reader, and then advances step-by-step, through some very deep issues and complex techniques. The method very consciously uses clear conversational English, with unique and interesting examples, and strictly avoids the use of undefined terms or jargon. This section is aimed primarily at developers and end users who are new to ORACLE, or need a quick review of certain ORACLE features. It moves step by step through the basic capabilities of SQL and ORACLE's interactive query facility, SQPLUS. When you've completed this section you should have a thorough understanding of all SQL key words, functions, and operators. You should be able to produce complex reports, create tables, and insert, update, and delete data from an ORACLE database. The later sections of Part II provide some very advanced methods in SQLPLUS, ORACLE's simple, command-line interface, and in-depth descriptions of the new and very powerful features of ORACLE.This is intended for developers who are already familiar with ORACLE, and especially those familiar with previous versions of ORACLE, but who have discovered needs they couldn't readily fill. Some of these techniques are previously unpublished and, in some cases, have been thought impossible. The tips and advanced techniques covered here demonstrate how to use ORACLE in powerful and creative ways. These include code-generation, programmatic loading of variables, and nesting of start files and host processes in SQLPLUS, as well as taking advantage of distributed database capabilities, triggers and stored procedures, and the other features in ORACLE8. You will also find extensive coverage of object-oriented features such as abstract datatypes, methods, object views object tables, nested tables, varying arrays, and large objects (LOBs). Part III, "The Hitchhiker's Guide to the ORACLE8 Data Dictionary," provides a user-oriented guide to the ORACLE8 data dictionary - the database equivalent of the Yellow Pages. Rather than list the available data dictionary views alphabetically, this section groups them by subject, thereby shortening the time it takes to discover which data dictionary view you need to use. Real-world examples are given to illustrate the proper usage of the available views. Part IV, "Designing for Productivity" addresses vital issues in the design of useful and well-received applications. ORACLE tools provide a great opportunity to create applications that are effective and well-loved by their users, but many developers are unaware of some of the approaches and successes that are possible. This section of the book is aimed specifically at developers - those individuals whose responsibility it is to understand a business (or other) application, and design and program an ORACLE application to satistfy it. This section should not be completely incomprehensible to an end user, but the audience is assumed to have a technical data processing background, and experience in developing computer application programs. The purpose here is to discuss the techniques of developing with ORACLE that have proven effective and valuable to end users, as well as to propose some new approaches to design in areas that have been largely, and sadly, ignored. This section includes "The Ten Commandments of humane Design," a list of all of the vital rules of the development process. A user-oriented guide to the ORACLE optimizer concludes this section. Part V, the "Alphatbetical Reference," is the complete reference for the ORACLE server. Reading the introductory pages to this reference will make its use much more effective and understandable. This section contains references for most major ORACLE commands, keywords, products, features and functions, with extensive cross-referencing of topics. Subtopics within a reference can be found in the index. The reference is intended for use by both developers and users of ORACLE but assumes some familiarity with the products. To make the most productive use of any of the entries, it would the worthwhile to read the first six pages of the reference. These explain in greater detail what is and is not included and how to read the entries. Part VI, "Appendix," contains table creation statements and row insertions for all of the tables used in this book. For anyone learning ORACLE, having these tables available on your own ORACLE ID, or on a practice ID, will make trying or expanding on the examples very easy. The CD that accompanies this book contains a special electronic edition of Oracle: The complete reference by Modern Age books. Now, with this electronic version you can easily store all of the valuable information contained in the book on your PC while the print version of the book remains in your office or home. A Brief Overview of the Chapters Chapter 1, "Sharing Knowledge and Success," explains thc basic ideas of the relational model, and the opphrtunity for successful application development by sharing design responsibilities with knowledgeable end users. Chapter 2, "The Dangers in a Relational Database," exposes some of the risks that are inherent in developing within a fast-paced, relational environment, and discusses many of the classic errors that have been made in the past. This chapter also introduces methods of risk control. Chapter 3, "The Basic Parts of Speech in SQL," is an introduction to the SOL language, the style used in this book, logic and value, subqueries, table joins, and view creation. Chapter 4, "The Basics of Object-Relational Databases," introduces the concept of abstract datatypes, the foundation of object-relational databases Chapter 5. "Basic SQLPLUS Reports and Commands," shows how to build a basic report in SQLPLUS, use an editor, use SQLPLUS commands and understand the differences between SQLPLUS and SQL. Chapter 6, "Getting Text Information and Changing It," introduces the idea of character strings, examines character functions and distinguishes between characters, numbers, and dates in ORACLE. Chapter 7, "Playing the Numbers," explores numbers and number functions, including single value, group value, and list functions. Chapter 8, "Dates: Then, Now, and the Difference," shows how to use ORACLE's exceptional date-handling functions, calculate differences between dates, and format dates for display. Chapter 9, "Conversion and Transformation Functions," looks at functions that convert one data type into another, or that "transform" data into some form other than that in which it normally appears. Chapter 10, "Grouping Things Together," shows how information In ORACLE can the grouped and summarized, and how views of summarized data can be created. Chapter 11, "When One Query Depends upon Another," looks at advanced subqueries, "correlated subqueries," a technique called the "outer join," and the use of UNION, INTERSECT, and MINUS operators to combine ORACLE tables. This chapter also contains an advanced discussion of precedence, and the use of outer joins and NOT EXISTS to replace the NOT IN operator. Chapter 12, "Some Complex Possibilities," shows how to build very complex views, and contains an extensive discussion of inheritance and CONNECT BY. Chapter 13, "Building a Report in SQI PLUS," explores advanced reporting and formatting techniques in SQLPLUS, weighted averages, variable use in titles, number formatting, and multi-statement SQL in reports. Chapter 14, "Changing Data: insert, update, and delete," discusses how data in ORACLE tables is changed, and the importance and effect of commit and rollback processing. Chapter 15, "Advanced Use of Functions and Variables," introduces methods for creating graphs and bar charts, inserting commas in numbers, doing complex cut-and-paste, and dynamically loading variables. Chapter 16, "DECODE-Amazing Power in a Single Word," goes into considerable depth about the use of the powerful DECODE function in ORACLE, including how to flip a table onto its side, age invoices, control paper movement in printers, or regulate commit processing for large groups of records. Chapter 17, "Creating, Dropping, and, Altering Tables and Views," details the basics of table manipulation, including constraint and partition specification, as well as the system views that contain information about tables. Chapter 18, "By What Authority?," explores security provisions in ORACLE - the authority of the Database Administrators, and the access privileges that each user can be granted, or can grant to others, and how changes in authority affect users dependent on other users. It also covers the use of ro1es in application and database administration. Chapter 19, "Changing the ORACLE Surroundings," looks at indexes, space usage, the structure of the database, the technique of clustering tables together, secquences, and basic ORACLE technical terms. Chapter 20, "SQLPLUS," is an advanced chapter tor experienced ORACLE developers and users. It shows methods for using SQLPLUS to generate code, load variables, create views with variable numbers of tables, and use host processes interactively. Chapter 21, "Accessing Remote Data," describes the meithods used to access data that is in a romote database and shows methods for creating and maintaining database links. Chapter 22, "An Introduction to PL/SQL," introduces the structures and features of ORACLE's procedural language extensions to SQL. Understanding PL/SQL is critical to exploiting features such as packages, procedures, and methods. Chapter 23, "Triggers," describes the types ot triggers available in ORACLE and shows examples of the most commonly used triggers. Chapter 24, "Procedures," shows how to use procedures, packages, and functions in ORACLE and how to create, compile, debug, and manage those objects. Chapter 25, "Implementing Types, Object Views, and Methods," shows the steps you need in order to implement the object-relational concepts first described in Chapter 4. The examples show how to overlay object-relational structures on your existing relational tables. Chapter 26, "Collectors (Nested Tables and Varying Arrays)," shows how to implement nested tables and varying arrays in your applications, and the management issues associated with them. Chapter 27, "Using Large Objects (LOBs) in ORACLE8," shows how to use the LOB datatypes available as of ORACLE8, and how to manipulate the values stored within LOB datatype columns. Chapter 28, "Snapshots," shows how to use ORACLE's snapshot objects to manage the replication of remote data. It also shows how the snapshot actually works, the objects that are created in local and remote databases, and how to manage the replication schedule. Chapter 29 "Using ConText for Text Searches," shows how to perform text searches (such as stem expansions, fuzzy matches, and phrase searches) within text strings. Chapter 30 "Configuring the ConText Option," shows how to configure your tables so you can use the search methods described in Chapter 29. This chapter is intended for use by application administrators who will need to configure and manage text indexes. Chapter 31, "Advanced Object-Oriented Concepts in ORACLE8," describes row objects and references, along with object extensions to PL/SQL. The concepts presented here are intended for the advanced developer who wants to implement object-oriented features withtn an ORACLE database. Chapter 32, "The Hitchhiker's Guide to the ORACLE8 Data Dictionary," Shows the most used data-dictionary views in a user-oriented fashion; views are organized by function to make it easy to find the proper view to use. Chapter 33, "Good Design Has a Human Touch," provides firm guidance on how to build applications that will be meaningful to their users and will genuinely support the tasks they have to accomplish. This approach is fundamental to real success in application development. Chapter 34, "Performance and Design," looks at some of the issues and fallacies surrounding normalization and design methods, and provides some explicit suggestions for improving both performance and design in ORACLE appliccitions. Chapter 35, "The Ten Commandments of Humane Design," introduces some new ideas to the relational community for the next steps in design methodology, including level-name integrity' object-name normalization, and singularity, as well as addressing related areas that have traditionally been fraught with difficulty. It concludes with ten basic rules for design. Chapter 36, "The Hitchhiker's Guide to the ORACLE Optimizer," explains how ORACLE accesses data and how it chooses which access path to use. The consequences of those choices are also shown, along with commands that allow you to predict and influence the chosen path. Chapter 37, "Alphabetical Reference," is the complete list of major ORACLE commands, keywords, functions, and so on Appendix A, "Tables Used in this Book," includes complete listings of all tables used in the examples in this book. Style Conventions Used in This Book Except when testing for an equality (such as City = 'CHICAGO'), ORACLE ignores upper-and lowercase. In the formal listing of commands, functions, and their format (syntax) in the Alphabetical Reference, this book will follow ORACLE's documentation style of putting all SQL in uppercase, and all variables in lowercase italic. Most users and developers of ORACLE, however, never key all their SQL. It's too much trouble and ORACLE doesn't care anyway. This book therefore will follow somewhat different style conventions in its examples (as opposed to its formal command and Action formats, mentioned earlier), primarily for readability. They are as follows: Boldface will not be used in example listings. select, from, where, order by, having and group by will be in boldface lowercase. SQLPLUS commands will be in boldface lowercase: column, set, save, ttitle, and so on. SQL operators and functions will be in boldface uppercase, such as IN, BETWEEN, UPPER, SOUNDEX, and so on. Columns will use upper- and lowercase, as in Feature, EastWest, Longitude, and so on. Tables will be in uppercase such as in NEWSPAPER, WEATHER, LOCATION, and so on. Chapter 3 contains an introduction to the style for chapters of the book through 36. Chapter 37, the Alphabetical Reference, contains an important introductory section on style conventions that should be read carefully before the alpabetical listings are used.