December 2002
Intermediate to advanced
928 pages
85h 29m
English
The COMPUTE command tells SQL*Plus to compute summary values for a group of records. COMPUTE is always used in tandem with BREAK. For example, to compute the number of tables owned by each user, you could do the following:
BREAK ON owner COMPUTE COUNT OF table_name ON owner SELECT owner, table_name FROM dba_tables ORDER BY owner, table_name;
SQL*Plus counts the number of table names for each distinct owner value and displays the results whenever a break occurs in the owner field.
You can compute summaries on multiple columns at once by using multiple COMPUTE commands.
Notice that the display order—the order used in the SELECT list—does not need to match the sort order or the break order.