BREAK ON: 可以让SQL*Plus根据列值的范围分割输出结果
COMPUTE: 可以让SQL*Plus计算一列的值
例:
BREAK ON product_type_id
COMPUTE SUM OF price ON product_type_id
COMPUTE SUM OF price ON product_type_id
SET ECHO OFF
SET VERIFY OFF
SET PAGESIZE 50
SET LINESIZE 70
SET VERIFY OFF
SET PAGESIZE 50
SET LINESIZE 70
CLEAR COLUMNS
COLUMN price HEADING Price FORMAT $999.99
COLUMN price HEADING Price FORMAT $999.99
SELECT product_type_id,name,price
FROM products
ORDER BY product_type_id;
FROM products
ORDER BY product_type_id;
CLEAR COLUMNS
SQL> @run
PRODUCT_TYPE_ID NAME Price
--------------- ------------------------------ --------
1 Modern Science $19.95
Chemistry $30.00
*************** --------
sum $49.95
2 Z Files $49.99
Tank War $13.95
Supernova $25.99
2412: The Return $14.95
*************** --------
sum $104.88
3 Space Force 9 $13.49
From Another Planet $12.99
*************** --------
sum $26.48
4 Classical Music $10.99
Pop 3 $15.99
Creative Yell $14.99
*************** --------
sum $41.97
My Front Line $13.49
*************** --------
sum $13.49
--------------- ------------------------------ --------
1 Modern Science $19.95
Chemistry $30.00
*************** --------
sum $49.95
2 Z Files $49.99
Tank War $13.95
Supernova $25.99
2412: The Return $14.95
*************** --------
sum $104.88
3 Space Force 9 $13.49
From Another Planet $12.99
*************** --------
sum $26.48
4 Classical Music $10.99
Pop 3 $15.99
Creative Yell $14.99
*************** --------
sum $41.97
My Front Line $13.49
*************** --------
sum $13.49
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17014649/viewspace-600891/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17014649/viewspace-600891/