Creating Advanced Reports

Now let's have some fun. By taking the concepts that you have learned today, as well as what you learned earlier, you can now create some fancy reports. Suppose that you have a script named report1.sql. Start it, sit back, and observe.

SQL> @report1 SQL> set echo on SQL> set pagesize 50 SQL> set feedback off SQL> set newpage 0 SQL> col product_name hea 'PRODUCT|NAME' for a20 trunc SQL> col unit_cost hea 'UNIT|COST' for $99.99 SQL> col product_qty hea 'QTY' for 999 SQL> col total for $99,999.99 SQL> spool report SQL> compute sum of total on customer SQL> compute sum of total on report SQL> break on report on customer skip 1 SQL> select o.customer, p.product_name, p.unit_cost, 2 o.product_qty, (p.unit_cost * o.product_qty) ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition 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.