8.1 Why Write Scripts?The most compelling reason to write scripts, in my mind, is to encapsulate knowledge. Suppose, for example, that you have developed a query that returns index definitions for a table. You certainly don't want to have to think through the entire process of developing that query each time you need to see an index. If you have a good script available, you just run it. Likewise, if someone asks you how to see index definitions for a table, you can give them a copy of the script.Another reason for developing scripts is that they save time and effort, making it easy to run a series of commands repeatedly. Look at the script in Example 5-5 used to produce the Project Hours and Dollars Report. It contains 16 commands, some quite long. Who wants to retype all that each time they generate a report? I sure don't, do you?Finally, scripts can simplify tasks for you and others. When you know you have a good, reliable script, you can run it, answer the questions, and sit back while it does all the work. You don't need to worry, thinking "Did I enter the correct command?" "Did I log on as the correct user?" "Did I get that query just right?" Any time you find yourself performing a task repeatedly, think about writing a script to do it for you. You'll save yourself time. You'll save yourself stress. You'll be able to share your knowledge more easily. |
• Table of Contents • Index • Reviews • Reader Reviews • Errata • Academic Oracle SQL*Plus: The Definitive Guide, 2nd Edition By
Jonathan Gennick Publisher : O''Reilly Pub Date : November 2004 ISBN : 0-596-00746-9 Pages : 582
Updated for Oracle 10g, this bestselling book is the only
in-depth guide to SQL*Plus. It clearly describes how to
perform, step-by-step, all of the tasks that Oracle
developers and DBAs want to perform with SQL*Plus--and maybe
some you didn''t realize you could perform. If you want to
leverage of the full power and flexibility of this popular
Oracle tool, this book is an indispensable resource.