Solved

oracle query

Posted on 2013-06-11
13
249 Views
Last Modified: 2013-09-10
CREATE TABLE TAB1
(
  DRIVE_DATE   DATE,
  SITE_CODE    VARCHAR2(5 BYTE),
  PROJECTION   NUMBER(4),
  DIVISION_CD  VARCHAR2(1 BYTE),
  A_T_B        VARCHAR2(1 BYTE),
  COACH_DRIVE  VARCHAR2(1 BYTE)
)

-----------------------




Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('03/31/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NA10', 24, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('03/31/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NL03', 17, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/01/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A401', 14, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/01/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BN04', 31, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/01/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'M115', 12, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BT15', 12, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C232', 33, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DE58', 35, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LI67', 14, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MT01', 26, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NA73', 32, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NK04', 12, 'A', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/02/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SY06', 18, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C254', 16, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DE33', 18, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'IT12', 19, 'B', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LI88', 18, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'M333', 12, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC31', 88, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NL04', 11, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OR61', 21, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'W909', 23, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/03/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WC33', 24, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/04/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AU47', 15, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/04/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DG22', 22, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/04/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EP02', 82, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AU31', 18, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CW39', 18, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HW01', 23, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NB05', 11, 'B', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PH32', 19, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/05/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WV04', 28, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A200', 10, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BO08', 15, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC39', 29, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NA81', 26, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OR15', 22, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C251', 24, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'GA25', 41, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MR16', 13, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OS56', 18, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C195', 21, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EB04', 26, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EV07', 45, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LB99', 18, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N216', 22, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PE02', 27, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SR06', 20, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WD15', 15, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CS04', 14, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HL06', 62, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LB03', 26, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LB04', 155, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C204', 19, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CH04', 16, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CL04', 79, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DA03', 46, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DO03', 41, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC22', 131, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OS10', 35, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WO11', 18, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HE26', 10, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LN02', 166, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC34', 26, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A268', 25, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A282', 14, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CCH6', 19, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CH14', 14, 'T', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MR10', 20, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OA83', 21, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/12/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SA19', 11, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/13/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BA06', 23, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/13/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA09', 33, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/13/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MI12', 22, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/13/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'RL02', 21, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/13/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'VP05', 20, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BA04', 33, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CG44', 28, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CY47', 19, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DE43', 57, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N334', 20, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NI04', 13, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/14/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WE33', 10, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AU71', 105, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BA04', 48, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BA11', 74, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BA61', 29, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LI27', 18, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LY06', 15, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC69', 115, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC83', 30, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TP05', 33, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TP93', 21, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/15/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WV36', 10, 'A', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/16/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HM06', 19, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/16/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LF01', 58, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/16/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SB18', 31, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/16/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WH16', 214, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/17/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DG09', 12, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/17/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'J156', 13, 'B', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/17/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LZ02', 66, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/17/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N425', 10, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/18/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C249', 22, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/18/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LB85', 12, 'B', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/18/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LE33', 12, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/19/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BI08', 10, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/19/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BL06', 16, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/19/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CY03', 29, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/19/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'H200', 14, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/19/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'J157', 18, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'BY06', 29, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EM18', 24, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EM24', 12, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'GL10', 14, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'JO83', 16, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/20/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N379', 15, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C227', 42, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HU02', 23, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LO17', 36, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MCH4', 34, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N354', 20, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/21/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WA03', 48, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CS68', 24, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CY80', 14, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EL25', 44, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HG04', 26, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HM04', 59, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC87', 10, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N430', 19, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/22/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PH28', 14, 'T', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A250', 82, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CG22', 27, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CI07', 10, 'B', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'KI09', 18, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N320', 16, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PL10', 28, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/23/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WV26', 11, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AH08', 13, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CI06', 20, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EK10', 16, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MR03', 61, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NU87', 24, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'OA73', 14, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PS02', 26, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/24/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SC22', 15, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A173', 15, 'A', NULL, 
    'M');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AU08', 43, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'AU83', 49, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DP13', 15, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LE03', 37, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/25/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NE03', 42, 'T', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/26/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A381', 13, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/26/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'GL01', 30, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/26/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LE35', 14, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/26/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MR16', 11, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/26/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'WV18', 25, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/27/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'GL01', 71, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/27/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'RO07', 44, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/28/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'DEK6', 64, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/28/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'HI02', 46, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/28/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'JT18', 25, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/28/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'SG02', 58, 'A', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C255', 25, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'LE34', 25, 'B', NULL, 
    'C');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MC25', 41, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'MR08', 82, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PL27', 67, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('04/29/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'RO06', 39, 'B', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('03/31/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'EL27', 15, 'A', NULL, 
    'N');
Insert into TAB1
   (DRIVE_DATE, SITE_CODE, PROJECTION, DIVISION_CD, A_T_B, 
    COACH_DRIVE)
 Values
   (TO_DATE('03/31/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'JT19', 13, 'B', NULL, 
    'M');
COMMIT;

Open in new window


----------------------
select drive_date,
       count(drive_DATE)||'/'||sum(projection) as both_drives,
	   coach_drive
  FROM tab1 
 WHERE DIVISION_CD = 'B'
  group by drive_date,coach_drive 
  
select drive_date,count(drive_DATE)||'/'||sum(projection) as aurora_drives,
       coach_drive
  FROM tab1
 WHERE DIVISION_CD = 'A'
  group by drive_date,coach_drive 

select drive_date,count(drive_DATE)||'/'||sum(projection) as tp_drives,
       coach_drive
  FROM tab1
 WHERE DIVISION_CD = 'T'
 group by drive_date,coach_drive

Open in new window


My requirement is

select drive_date,
       count(drive_DATE)||'/'||sum(projection) as both_drives,
	   coach_drive as both_coach_drive
  FROM tab1 
 WHERE DIVISION_CD = 'B'
  group by drive_date,coach_drive 
  
select drive_date,count(drive_DATE)||'/'||sum(projection) as aurora_drives,
       coach_drive as aurora_coach_drive
  FROM tab1
 WHERE DIVISION_CD = 'A'
  group by drive_date,coach_drive 

select drive_date,count(drive_DATE)||'/'||sum(projection) as tp_drives,
       coach_drive as tp_coach_drive
  FROM tab1
 WHERE DIVISION_CD = 'T'
 group by drive_date,coach_drive

Open in new window

------------------------------------

Want the columns displayed like below

drive date, aurora_drives,aurora_aoach_drive,tp_drives,tp_coach_drives,both_drives,both_coach_drives.

in a tabular format.
sample-data.xls
0
Comment
Question by:anumoses
  • 5
  • 4
  • 3
13 Comments
 
LVL 5

Expert Comment

by:DOSLover
ID: 39238966
A Decode function can help in this situation as follows:
Select drive_date
	  ,aurora_coach_drive,sum(aurora_drives) as aurora_drives
	  ,tp_coach_drive,sum(tp_drives) as tp_drives
	  ,both_coach_drive,sum(both_drives) as both_drives
(select drive_date
	  ,DECODE(DIVISION_CD,'A',coach_drive) as auroa_coach_drive
	  ,DECODE(DIVISION_CD,'A',count(drive_DATE)||'/'||sum(projection)) as aurora_drives
	  ,DECODE(DIVISION_CD,'T',coach_drive) as tp_coach_drive
	  ,DECODE(DIVISION_CD,'T',count(drive_DATE)||'/'||sum(projection)) as tp_drives
	  ,DECODE(DIVISION_CD,'B',coach_drive) as both_coach_drive
	  ,DECODE(DIVISION_CD,'B',count(drive_DATE)||'/'||sum(projection)) as both_drives
  FROM tab1 
 WHERE group by drive_date,coach_drive 
)
group by drive_date,aurora_coach_drive,tp_coach_drive,both_coach_drive

Open in new window

0
 
LVL 6

Author Comment

by:anumoses
ID: 39239023
ORA-00936: missing expression
0
 
LVL 6

Author Comment

by:anumoses
ID: 39239042
select drive_date
        ,DECODE(DIVISION_CD,'A',coach_drive) as aurora_coach_drive
        ,DECODE(DIVISION_CD,'A',count(drive_DATE)||'/'||sum(projection)) as aurora_drives
        ,DECODE(DIVISION_CD,'T',coach_drive) as tp_coach_drive
        ,DECODE(DIVISION_CD,'T',count(drive_DATE)||'/'||sum(projection)) as tp_drives
        ,DECODE(DIVISION_CD,'B',coach_drive) as both_coach_drive
        ,DECODE(DIVISION_CD,'B',count(drive_DATE)||'/'||sum(projection)) as both_drives
  FROM tab1
 group by drive_date,coach_drive,division_cd

This code works fine.
Can I have all in one line data for each drive_date?
0
 
LVL 6

Author Comment

by:anumoses
ID: 39239067
Drive Date   Aurora drives   TP Drives   Both Drives
3/31/2014       1/15                  1/17           2/37
0
 
LVL 5

Assisted Solution

by:DOSLover
DOSLover earned 250 total points
ID: 39239302
The outer select does the required grouping to date level:
Select drive_date
	  ,sum(aurora_drives) as aurora_drives
	  ,sum(tp_drives) as tp_drives
	  ,sum(both_drives) as both_drives
(select drive_date
	  ,DECODE(DIVISION_CD,'A',coach_drive) as auroa_coach_drive
	  ,DECODE(DIVISION_CD,'A',count(drive_DATE)||'/'||sum(projection)) as aurora_drives
	  ,DECODE(DIVISION_CD,'T',coach_drive) as tp_coach_drive
	  ,DECODE(DIVISION_CD,'T',count(drive_DATE)||'/'||sum(projection)) as tp_drives
	  ,DECODE(DIVISION_CD,'B',coach_drive) as both_coach_drive
	  ,DECODE(DIVISION_CD,'B',count(drive_DATE)||'/'||sum(projection)) as both_drives
  FROM tab1 
 WHERE group by drive_date,coach_drive,Division_cd 
)
group by drive_date

Open in new window

0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39240117
anumoses :(

in the toolbar immediately above the question and comment text boxes is a "code" feature.
it produces a much cleaner representation of code and saves ~27.25 pages depths to reach this far.

you are to be commended for supplying test data in an insert format - that's really helpful. It would take just a millisecond or so extra to use the code feature. (please?)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 48

Accepted Solution

by:
PortletPaul earned 250 total points
ID: 39240137
NO points pl.

Just a small offering to assist (there a missing 'from' and some redundancy due to reduced number of columns)
SELECT
  drive_date
, max(aurora_drives) AS aurora_drives
, max(tp_drives)     AS tp_drives
, max(both_drives)   AS both_drives
FROM (
      SELECT
          drive_date
        , DECODE(DIVISION_CD,'A',count(drive_DATE)||'/'||sum(projection)) AS aurora_drives
        , DECODE(DIVISION_CD,'T',count(drive_DATE)||'/'||sum(projection)) AS tp_drives
        , DECODE(DIVISION_CD,'B',count(drive_DATE)||'/'||sum(projection)) AS both_drives
       FROM tab1
       GROUP BY drive_date,coach_drive,division_cd
      )
GROUP BY drive_date

Open in new window

http://sqlfiddle.com/#!4/39513/7
0
 
LVL 6

Author Comment

by:anumoses
ID: 39240974
@PortletPaul

I have to give points as this is the query that works and what was expected. Though I had to make more changes to bring everything into one line data, this helped me. The other query did not work.
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39241039
the query by DOSlover at ID: 39239302 is almost correct - it just missed a 'from' really
I also removed 3 unwanted decodes (as you indicated they weren't being used)

If you wish to award me the accepted answer that's fine - but do also give assisted answer to DOSLover and a good share of the points, I merely tweaked that query.
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39241935
thanks
0
 
LVL 5

Expert Comment

by:DOSLover
ID: 39242307
Thanks, PortletPaul, It is very nice of you to share. I am glad you made it work for Anumoses.
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39242882
DOSLover, thank you for the neat solution, I so rarely use decode, but here it worked very nicely. And, thank you anumoses. (& do please use that code button?)  Cheers, Paul.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  â€¦
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now