Oracle PL/SQL/SQL Plus/compute
Версия от 13:45, 26 мая 2010; (обсуждение)
compute sum of cnt on report
SQL>
SQL> set echo on
SQL>
SQL> create table t as
2 select * from all_objects;
Table created.
SQL>
SQL> create index t_idx1 on t(object_name);
Index created.
SQL>
SQL> create index t_idx2 on t(object_type);
Index created.
SQL>
SQL> compute sum of cnt on report
SQL> break on report
SQL> select object_type, count(*) cnt from t group by object_type;
OBJECT_TYPE CNT
------------------- ----------
CONSUMER GROUP 2
INDEX PARTITION 80
SEQUENCE 110
SCHEDULE 1
TABLE PARTITION 72
RULE 4
QUEUE 2
PROCEDURE 99
OPERATOR 45
WINDOW 2
PACKAGE 727
PACKAGE BODY 685
LIBRARY 133
RULE SET 13
PROGRAM 3
LOB 1
TYPE BODY 122
CONTEXT 3
XML SCHEMA 13
TRIGGER 220
JOB CLASS 2
DIRECTORY 6
TABLE 1176
INDEX 1437
SYNONYM 2800
VIEW 2988
FUNCTION 201
WINDOW GROUP 1
INDEXTYPE 8
CLUSTER 10
TYPE 1231
EVALUATION CONTEXT 11
JOB 4
----------
sum 12212
33 rows selected.
SQL>
SQL> drop table t;
Table dropped.
SQL>
SQL> --