Crystal Reports 9 on Oracle ISBN:0072230797 by Annette Harper McGraw-Hill © 2003 (390 pages) This text explores connectivity options, then delves into optimization methods that can be implemented in the Crystal environment, including the use of SQL Expressions and SQL Commands, and much more Table of Contents Crystal Reports 9 on Oracle Introduction Connectivity, Chapter 1 - Authentication, and Privileges Chapter 2 - Oracle Structures Chapter 3 - Oracle SQL Oracle Advanced SELECT Chapter 4 Options Chapter 5 - PL/SQL Optimizing: The Crystal Chapter 6 Reports Side Optimizing: The Oracle Chapter 7 - Side Optimizing: Reducing Chapter 8 Parses Chapter 9 - Other Tips Chapter 10 - Data Dictionary Report Chapter 11 - The Crystal Repository Appendix A - Common Issues Appendix B - Functions Index List of Figures List of Tables Back Cover Create dynamic, effective reports from Oracle databases using Crystal Reports 9 and the extensive information in this practical resource Learn to use one of the most powerful data analysis tools to draw information from Oracle databases, query and rank data, consolidate results, and develop integrated, interactive reports Plus, leverage the power of the Oracle database in your reports You’ll find full details on everything from Oracle SQL and PL/SQL functions, procedures, and expressions to the Oracle data dictionary and the new Crystal object repository Get the insider advice you need to optimize performance, solve difficult reporting problems, and integrate nonOracle data About the Author Annette Harper, OCP, ACE, MCNE, has worked with Crystal Reports with various enterprise databases for several years She is an Oracle Certified Professional DBA both for Oracle9i and Oracle8i as well as a Certified Crystal Reports Authorized Crystal Engineer Crystal Reports 9 on Oracle Annette Harper McGraw-Hill/Osborne 2100 Powell Street, 10th Floor Emeryville, California 94608 U.S.A To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please contact McGraw-Hill/Osborne at the above address For information on translations or book distributors outside the U.S.A., please see the International Contact Information page immediately following the index of this book Copyright © 2003 by The McGraw-Hill Companies All rights reserved Printed in the United States of America Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication 1234567890 CUS CUS 019876543 ISBN 0-07-223079-7 Publisher Brandon A Nordin Vice President & Associate Publisher Scott Rogers Editorial Director Wendy Rinaldi Project Editors Betsy Manini, Patty Mon, Jenn Tust Acquisitions Coordinator Athena Honore Technical Editor Deborah Bechtold Copy Editor Sally Engelfried Proofreader Stefany Otis Indexer Valerie Perry Production Supervisor James Kussow Composition Tabitha M Cagan Illustrators Kathleen Edwards, Melinda Lytle, Michael Mueller, Lyssa Wald Series Designer Peter F Hancik, Roberta Steele Cover Series Designer Pattie Lee This book was composed with Corel VENTURA™ Publisher Information has been obtained by McGraw-Hill/Osborne from sources believed to be reliable However, because of the possibility of human or mechanical error by our sources, McGraw-Hill/Osborne, or others, McGraw-Hill/Osborne does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information This book is dedicated to my husband, Chris Without his encouragement and support, it would not exist He is the strength behind my commitment, the sounding board for my ideas, and the heart in my soul About the Author Annette Harper has worked with Crystal Reports for more than eight years and with Oracle for five years She was previously the Division Manager of Decision Support for the Investment Department of the Nationwide Insurance Company, where she led the reporting and data warehousing teams Annette now runs her own consulting firm, Sage Link, LLC, (www.sage-link.com) doing report and database consulting She holds the Oracle Certified Professional DBA designation (OCP) for both Oracle 8i and Oracle 9i She is also a Crystal Reports Authorized Crystal Engineer (ACE), and a Master CNE Annette’s e-mail address is annette@sage-link.com, and she encourages readers to contact her with any comments or questions about the book Acknowledgments I would like to thank Wendy Rinaldi at Osborne/McGraw-Hill for seeing a worthwhile book in an unsolicited book proposal; Athena Honore for keeping track of everything throughout the project; Deborah Bechtold for her technical insights; and Betsy Manini and Sally Engelfried for improving the quality of my writing Thanks to my daughter, Katie, for putting up with no Mom for the summer, and to my mother and sisters for “not calling till after 6 PM.” Introduction Crystal Reports 9 is a wonderful, full-featured, report-writing tool If you are using Crystal Reports with Oracle databases, the topics in this book will make you a better report developer All major RDBMS have many similarities, but an in-depth understanding of your particular database, in this case Oracle, will allow you to take advantage of its unique features You will create reports that are more efficient and will do so quickly and easily; you will develop reports that run faster, use fewer server and network resources, and are easier to maintain You will also reduce development time and be able to solve complicated reporting problems using Oracle features This book assumes that you have a moderate level of expertise with Crystal Reports 9 It does not cover generic report-writing topics You should investigate one of the other available Crystal Reports books if you need to learn Crystal Reports There is often perceived to be a wide gulf between “report writers” and “database developers.” This distinction is artificial As a report developer, you are writing queries against the database just as any database developer would You might even be creating views and stored procedures A couple of significant differences are that you are probably not modifying data, and you are probably returning more information per query than the typical application query would require Hence, this book does not cover database modification, but it does cover query optimization To write truly efficient, powerful reports, you need to have a solid understanding of the database and how it processes your queries This book will supply you with the Oracle information that you need as a report writer In addition to coverage of basic Oracle topics, such as structures, datatypes, and the SQL SELECT statement, you will find chapters dealing with creating stored procedures for use with Crystal Reports, picking the best connection methods, optimization from both within Crystal Reports and on the backend Many sample queries and reports are given, including subreports that you can add to your own reports that display the database statistics and execution plan for the main report A database dictionary report is developed that you can use in your own environment to document your database structures, and the Crystal repository is ported to Oracle and given Oracle security features In some situations, two plus two is much greater than four When you add Oracle-specific skills to your Crystal Reports skills, you will advance to the next level of report development About the Source Code All report files, SQL scripts, and other files referenced in this book are available for download from www.osborne.com From the Osborne home page, click the Free Code link and you will be taken to the downloads page Scroll down until you see Crystal Reports 9 on Oracle Under the book title, there are links to three zip files The first link contains all required files You should download and unzip them for use as you read the book The files are organized by chapter number and some chapters have subfolders for lower levels of organization Three types of files exist in the download; Crystal Reports 9 report files (rpt), Oracle SQL scripts (sql), and plain text files (txt) The last two links contain an Oracle export or dump of the XTREME schema used in the book, one for Oracle 9.2, and one for Oracle 8.1.7 The use of these files is optional and is an alternative method for populating the XTREME schema given in Chapter 1 Download the file for your version of Oracle only if you wish to import the XTREME schema directly See Chapter 1 for instructions Chapter 1: Connectivity, Authentication, and Privileges This chapter covers the installation and configuration of the components required to use Crystal Reports with Oracle The Crystal Reports Access sample database and reports are modified for use with Oracle Different connectivity options are compared, and Oracle user IDs, authentication methods, and basic database privileges are explained After reading this chapter, you will be able to connect to Oracle from Crystal Reports using one of seven possible methods, and you will understand the tradeoffs of those connection methods All connectivity discussions that follow assume Crystal Reports version 9, Oracle 9i (with differences for Oracle 8i noted), and a Windows client workstation A direct client/server type of connection is also assumed Connection through a middle tier or application server is not covered ... She is an Oracle Certified Professional DBA both for Oracle9 i and Oracle8 i as well as a Certified Crystal Reports Authorized Crystal Engineer Crystal Reports 9 on Oracle Annette Harper McGraw- Hill/ Osborne 2100 Powell Street, 10th Floor... This chapter covers the installation and configuration of the components required to use Crystal Reports with Oracle The Crystal Reports Access sample database and reports are modified for use with Oracle Different connectivity options are compared, and Oracle user IDs, authentication... one of seven possible methods, and you will understand the tradeoffs of those connection methods All connectivity discussions that follow assume Crystal Reports version 9, Oracle 9i (with differences for Oracle 8i noted), and a Windows client workstation A direct client/server type of connection is also assumed