Skip to Main Content
Oracle SQL*Plus: The Definitive Guide
book

Oracle SQL*Plus: The Definitive Guide

by Jonathan Gennick
March 1999
Intermediate to advanced content levelIntermediate to advanced
528 pages
14h 39m
English
O'Reilly Media, Inc.
Content preview from Oracle SQL*Plus: The Definitive Guide

Chapter 7. Advanced Scripting

SQL*Plus was not designed to be a tool used for writing complex scripts. Its capabilities cannot compare to those of your typical Unix shell, such as the Korn shell or the Bourne shell. Nor does it have anywhere near the capabilities of an advanced scripting tool such as Perl. Most noticeably, SQL*Plus suffers from the following limitations:

  • It lacks an IF statement.

  • There are no looping constructs.

  • It has very limited error handling.

  • There is only marginal support for validating user input.

Because of these limitations, SQL*Plus is best suited to executing top-down scripts that don’t require any branching, looping, or error handling. Most of the scripts you have seen so far in this book fall into this category. Many are reports that simply set up some column and page formatting, then execute a query. If something goes wrong, you either don’t see any data in the report or may see some SQL or SQL*Plus error messages.

This limited scripting support is fine when it comes to producing a report. After all, if a report fails, you can simply fix the problem and rerun the report. But what if you are performing a more complex and critical task? What if you are summarizing some data, posting the summary results to a summary table, and then deleting the underlying detail? In that case, you certainly wouldn’t want to delete the data if the summarization failed. You would need some sort of error-handling mechanism.

Tip

If you need to write scripts of any significant ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Jonathan Gennick
Oracle PL/SQL Programming, Third Edition

Oracle PL/SQL Programming, Third Edition

Steven Feuerstein, Bill Pribyl
Oracle SQL

Oracle SQL

Dan Hotka

Publisher Resources

ISBN: 1565925785Supplemental ContentCatalog PageErrata