Chapter 3. Generating Reports with SQL*Plus

SQL*Plus is a very effective reporting tool. You can count on having SQL*Plus available in any Oracle environment, and it gets the job done well with a minimum of fuss. This chapter shows you how to leverage the power of SQL*Plus to produce reports, and presents a report development methodology that works well in most situations.

Following a Methodology

Designing a report is a development project, albeit a very small one. As with any development project, it helps to have a methodology, or sequence of steps, to follow that will lead you successfully through the process of designing a report with a minimum of fuss and backtracking. For example, when designing a report, it makes no sense to worry about formatting the data until you have first decided what data to include.

This chapter presents a micro-methodology for developing reports with SQL*Plus that has worked very well for me. It divides the design process for a simple report into the following steps:

  1. Formulate the query.

  2. Format the columns.

  3. Add page headers and footers.

  4. Format the page.

  5. Print it.

Dividing the design process into discrete, logical steps reduces both the amount and the complexity of the information you must keep in your head at any given time.

For more advanced reports, such as a master-detail report, there are some additional tasks you may want to perform. These include:

  • Add page and line breaks

  • Add totals and subtotals

Try to work through report design in a methodical ...

Get Oracle SQL*Plus: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.