Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

        
 
     Oracle:

 
Using the GROUPING function
 
To handle these NULL issues, Oracle 8i introduces a new function called GROUPING.  Using a single column as its argument, Grouping returns 1 when it encounters a NULL value created by a ROLLUP or CUBE operation.
 
That is, if the NULL indicates the row is a subtotal, GROUPING returns a 1. Any other type of value, including a stored NULL, will return a 0.
 
GROUPING = 0 is a stored NULL not created by ROLLUP or CUBE
 
GROUPING = 1 is a NULL value created by ROLLUP or CUBE
 
Here is a simple example at aggregates employee data.
 
 
SELECT
   deptno,
   job,
   count(*),
   sum(sal),
GROUPING(Job)
FROM
   emp
GROUP BY
   ROLLUP(deptno,job);
 
 
 
   DEPTNO JOB         COUNT(*)  SUM(SAL) GROUPING(JOB)
--------- --------- --------- --------- -------------
       10 CLERK              1       1300              0
       10 MANAGER            1       2450              0
       10 PRESIDENT          1       5000              0
       10                    1       1000              0
       10                    4       9750              1
<== Aggregate
       20 ANALYST            2       6000              0
       20 CLERK              2       1900              0
       20 MANAGER            1       2975              0
       20                    5      10875              1
       30 CLERK              1        950              0
       30 MANAGER            1       2850              0
       30 SALESMAN           4       5600              0
       30                    6       9400              1
<== Aggregate
                            15      30025              1
<== Aggregate
 
 
Here we see that the database has computed aggregate values for each department and also for the total result set.


 

     

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.