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.


Oracle SQL Plus The Definitive Guide, 2nd Edition
Oracle SQL*Plus: The Definitive Guide (Definitive Guides)
ISBN: 0596007469
EAN: 2147483647
Year: N/A
Pages: 151
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net