Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Aggregate Functions
 

Sum with group by cude

SQL> SQL> select         owner,   2                 tablespace_name,   3                 sum(bytes)/(1024*1024) total_meg   4      from dba_extents   5      where rownum < 50   6      group by cube (owner,tablespace_name)   7      / OWNER                          TABLESPACE_NAME                 TOTAL_MEG ------------------------------ ------------------------------ ----------                                                                        4                                SYSTEM                                  4 SYS                                                                    4 SYS                            SYSTEM                                  4