## Example of how to combine two "like" cursors via a "decode".


   SELECT COUNT(*), SUM(SALARY)
   FROM   EMP
   WHERE  DEPT_NO  =  0020
   AND    EMP_NAME LIKE 'SMITH%' ;

   SELECT COUNT(*), SUM(SALARY)
   FROM   EMP
   WHERE  DEPT_NO  =  0030
   AND    EMP_NAME LIKE 'SMITH%' ;



   SELECT COUNT(DECODE(DEPT_NO, 0020, 'X',    NULL)) D0020_KOUNT,
          COUNT(DECODE(DEPT_NO, 0030, 'X',    NULL)) D0030_KOUNT,
          SUM  (DECODE(DEPT_NO, 0020, SALARY, NULL)) D0020_SAL,
          SUM  (DECODE(DEPT_NO, 0030, SALARY, NULL)) D0030_SAL
   FROM   EMP 
   WHERE  EMP_NAME LIKE 'SMITH%';


## Using a "decode" in the "order by" or "group by" clause can enable
## us to share similar SQL 

   SELECT . . .    
   FROM   EMP 
   WHERE  EMP_NAME LIKE 'SMITH%'
   ORDER
       BY DECODE(:BLK.SEQN_FLD 'E', EMP_NO, 'D', DEPT_NO);


   SELECT . . .
   FROM   EMP 
   WHERE  EMP_NAME  LIKE  'SMITH%'
   GROUP
       BY DECODE(:INPUT,'E',EMP_NO,'D',DEPT_NO);
