Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

oracle query

Posted on 2013-05-13
7
Medium Priority
?
340 Views
Last Modified: 2013-05-22
select drive_date,drive_id,bd.site_code,site_name,
       sum(nvl(projection,0)) projection,
       sum(nvl(actual_draw,0))actual,
       area_rep_no,
      CASE
         WHEN coach_drive='C' THEN 'Coach'
         WHEN coach_drive='M' THEN 'Mini'
         ELSE 'Inside'
       END coach_drive
  from blood_drives bd,sites s,blood_drives_audit bda
 where bd.site_code = s.site_code
   and bd.audit_kay = bda.audit_key
   and drive_date between '01-may-2013' and '15-may-2013'
   and drive_cancelled is null
    group by drive_date,drive_id,bd.site_code,site_name,area_rep_no,coach_drive

In the blood_drives_audit I have a field called column_name and the data here is projection. ie column_name = 'projection'

I need a to add this to the query above.

if column_name = 'projection' and the value is not null then take
 value from blood_drives_audit table where column_name = projection
else value from blood_drives table

kind of this one
and sum(nvl(bda.column_name,bd.projection)) projection,
Help is appreciated.
0
Comment
Question by:anumoses
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39161899
Maybe something like:

case when bda.column_name='projection' and bda.value is not null then bda.value
   when bd.column_name='projection' and bd.value is not null then bd.value
   else null
end
0
 
LVL 32

Expert Comment

by:awking00
ID: 39162603
Some sample data and your expected output are always helpful.
0
 
LVL 49

Assisted Solution

by:PortletPaul
PortletPaul earned 500 total points
ID: 39163670
afraid I might not have understood "the value" but there might be a summable value in a field called 'projection', so:
SELECT
      drive_date
    , drive_id
    , bd.site_code
    , site_name
    , sum(case when bda.column_name='projection' then NVL(bda.projection,bd.projection) end) projection
    , sum(actual_draw) actual
    , area_rep_no
    , CASE WHEN coach_drive = 'C' THEN 'Coach' WHEN coach_drive = 'M' THEN 'Mini' ELSE 'Inside' END coach_drive
FROM blood_drives bd
INNER JOIN sites s ON  bd.site_code = s.site_code
INNER JOIN blood_drives_audit bda ON  bd.audit_kay = bda.audit_key
WHERE drive_date >= '01-may-2013' AND drive_date < '16-may-2013'
    AND drive_cancelled IS NULL
GROUP BY drive_date
    , drive_id
    , bd.site_code
    , site_name
    , area_rep_no
    , CASE WHEN coach_drive = 'C' THEN 'Coach' WHEN coach_drive = 'M' THEN 'Mini' ELSE 'Inside' END

Open in new window

I've also messed with other bits here - sorry couldn't help myself. SUM() will simply ignore nulls, got to a point where old join syntax just looks weird and, I have a dread of using between for date ranges.

if you strongly prefer use of zeros in your sums, then you could do this instead of the above:

    , sum(case when bda.column_name='projection' then COALESCE(bda.projection,bd.projection,0) end) projection
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 6

Author Comment

by:anumoses
ID: 39164587
CREATE TABLE TAB1
(
  DRIVE_DATE   DATE                             NOT NULL,
  DRIVE_ID     NUMBER(7)                        NOT NULL,
  AUDIT_KEY    NUMBER,
  PROJECTION   NUMBER(4)                        NOT NULL,
  ACTUAL_DRAW  NUMBER(4)
)



Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019157, 167315, 25, 15);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019464, 167618, 11, 7);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021816, 170063, 12, 13);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019407, 167561, 31, 24);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019390, 167544, 21, 17);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018085, 166278, 25, 7);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/02/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019433, 167587, 50, 14);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/02/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019475, 167629, 46, 32);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/02/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019460, 167614, 12, 12);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/02/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019265, 167419, 9, 6);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021841, 170099, 12, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019414, 167568, 24, 12);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2020191, 168345, 45, 33);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019415, 167569, 15, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019416, 167570, 30, 35);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019417, 167571, 16, 14);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019141, 167299, 31, 26);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019174, 167332, 34, 32);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019418, 167572, 13, 12);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/03/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019129, 167287, 25, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021839, 170097, 35, 16);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021728, 169984, 10, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018938, 167093, 21, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019142, 167300, 15, 19);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019143, 167301, 25, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018056, 166249, 19, 12);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018775, 166943, 88, 88);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019467, 167621, 21, 11);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019144, 167302, 22, 3);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019419, 167573, 16, 21);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021461, 169725, 5, 1);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019448, 167602, 33, 23);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019145, 167303, 25, 24);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/05/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019146, 167304, 21, 15);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/05/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019248, 167402, 24, 22);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/05/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018524, 166704, 73, 82);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/05/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018769, 166937, 72, 72);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019150, 167308, 24, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019151, 167309, 16, 4);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021514, 169772, 20, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021851, 170108, 21, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019153, 167311, 26, 23);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021504, 169762, 10, 1);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019454, 167608, 11, 11);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021840, 170098, 15, 0);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019398, 167552, 25, 19);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/06/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018219, 166412, 31, 28);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/07/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018352, 166532, 18, 10);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/07/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019430, 167584, 21, 15);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/07/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019404, 167558, 21, 29);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/07/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019432, 167586, 21, 26);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/07/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019405, 167559, 21, 22);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021843, 170101, 35, 24);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019406, 167560, 36, 41);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021754, 170005, 9, 5);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2021749, 170000, 12, 9);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019160, 167318, 20, 13);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019168, 167326, 15, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/08/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019689, 167843, 16, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019162, 167320, 16, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018823, 166990, 25, 21);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2020723, 168887, 25, 7);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018774, 166942, 37, 26);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2020652, 168815, 25, 45);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019472, 167626, 10, 6);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019165, 167323, 21, 18);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019166, 167324, 25, 22);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019167, 167325, 9, 8);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019393, 167547, 10, 4);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019411, 167565, 31, 27);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019343, 167497, 22, 20);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/09/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019169, 167327, 25, 15);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/10/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019170, 167328, 16, 14);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/10/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018667, 166844, 100, 93);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/10/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2018641, 166818, 85, 62);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/10/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019172, 167330, 16, 26);
Insert into TAB1
   (DRIVE_DATE, DRIVE_ID, AUDIT_KEY, PROJECTION, ACTUAL_DRAW)
 Values
   (TO_DATE('04/10/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2019171, 167329, 153, 155);
COMMIT;

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


CREATE TABLE TAB2
(
  COLUMN_NAME  VARCHAR2(50 BYTE),
  OLD_VALUE    VARCHAR2(240 BYTE),
  NEW_VALUE    VARCHAR2(240 BYTE),
  AUDIT_KEY    NUMBER                           NOT NULL
)



Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166278);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166412);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/09/2013 00:00', '04/08/2013 00:00', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '9', '25', 167315);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 167318);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '1', 167318);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167325);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167325);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_cancelled', NULL, '09/13/2012 00:00', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/10/2013 00:00', '04/03/2013 00:00', 167332);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167332);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/18/2013 00:00', '04/25/2013 00:00', 166942);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '75', '37', 166942);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/18/2013 00:00', '04/04/2013 00:00', 166943);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '75', '88', 166943);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 167618);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '1', 167618);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167626);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167626);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'M', 167419);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167419);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/20/2013 00:00', '04/06/2013 00:00', 167608);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167608);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_cancelled', '09/13/2012 00:00', NULL, 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166704);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'M', 'C', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '1', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/25/2013 00:00', '04/05/2013 00:00', 166937);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '02/22/2013 00:00', '02/15/2013 00:00', 166704);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166844);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166818);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166937);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166942);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166943);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/09/2013 00:00', '04/08/2013 00:00', 167327);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167327);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 166249);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/08/2013 00:00', '04/09/2013 00:00', 167327);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '1', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '08/07/2013 00:00', '04/03/2013 00:00', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '16:00', '13:00', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '71', '51', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '02/03/2013 00:00', '04/07/2013 00:00', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '02/15/2013 00:00', '04/05/2013 00:00', 166704);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '5', '21', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '18', '21', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '2', 167629);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '31', '21', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/21/2013 00:00', '04/02/2013 00:00', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/15/2013 00:00', '04/02/2013 00:00', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '09:00', '09:00', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '25', '31', 167561);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '01/11/2013 00:00', '04/01/2013 00:00', 166278);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'Y', 'N', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '28', '31', 167299);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'MOBILE COACH DRIVE', 'Auditorium', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'MOBILE COACH', 'Fellowship Hall', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '21', '15', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/19/2013 00:00', '04/09/2013 00:00', 167497);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '16:00', '15:30', 167324);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '24', '25', 167324);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '02/02/2013 00:00', '04/06/2013 00:00', 166412);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '44', '31', 166412);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/08/2013 00:00', '04/01/2013 00:00', 167315);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '11:30', '11:00', 170097);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '15:30', '15:00', 170097);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '12', '21', 167621);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '10:00', '09:00', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '14:00', '13:00', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '12:30', '13:00', 166249);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '29', '21', 167323);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '21', '25', 167327);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/28/2013 00:00', '04/01/2013 00:00', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'GYM (inside Franciscan Hall)', 'MOBILE COACH', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '09:00', '08:30', 167626);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/29/2013 00:00', '03/27/2013 00:00', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/27/2013 00:00', '03/12/2013 00:00', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '23', '21', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '16', '21', 167586);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '09:00', '08:00', 167569);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 170005);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '16:30', '17:00', 170005);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '19:00', '19:30', 170005);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/22/2013 00:00', '04/04/2013 00:00', 167621);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Group Exercise Room', '-UNASSIGNED-', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', '-UNASSIGNED-', 'Coach', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 170097);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_cancelled', NULL, '02/20/2013 00:00', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('site_code', 'LB76', 'LB03', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('sponsor_group_code', 'LB76', 'LB03', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Mobile Coach Drive', 'Coach drive', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Downstairs', 'MOBILE COACH', 167618);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '20', '21', 167304);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '10:00', '09:30', 169772);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '01/08/2013 00:00', '04/04/2013 00:00', 166249);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167552);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167315);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167561);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166278);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'M', 'C', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '9', '10', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '16:00', '15:15', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '20', '25', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '20', '21', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167568);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167299);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167093);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166943);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167602);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167402);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '2', 166937);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167308);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 169772);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167311);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167552);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '2', 167560);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 168815);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167324);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167497);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 167300);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '15', '16', 167571);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'Y', 'N', 170099);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '25', '30', 167570);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'M', 'C', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '14', '25', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '14:30', '13:30', 167300);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '9', '15', 167300);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '13:00', '12:00', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '21', '16', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 167558);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167558);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Living Room', 'MOBILE COACH', 167558);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'M', 'C', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167326);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'Y', 'N', 170000);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '11:30', '12:30', 170000);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '14:30', '15:30', 170000);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '10', '13', 170000);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/12/2013 00:00', '04/09/2013 00:00', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_cancelled', '02/20/2013 00:00', NULL, 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 169725);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 169725);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Coach', 'Pilates Room', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '15', '25', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167586);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('sponsor_group_code', 'SY06', 'SY23', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '14:00', '15:00', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 170101);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('sponsor_group_code', 'SY23', 'SY06', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/01/2013 00:00', '04/05/2013 00:00', 167402);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/02/2013 00:00', '04/09/2013 00:00', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '10:30', '09:00', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '05/29/2013 00:00', '04/08/2013 00:00', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '16:00', '09:30', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '19:30', '13:00', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '05/01/2013 00:00', '04/03/2013 00:00', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '25', '20', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 167608);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '51', '45', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167402);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167497);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167544);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '2', 166704);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/25/2013 00:00', '04/09/2013 00:00', 166942);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '9', '12', 167419);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '12', '9', 167419);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167552);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167558);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167561);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167629);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167568);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167569);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167570);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167571);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167299);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167572);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167093);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167300);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167302);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167602);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167304);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167308);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167311);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167586);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167315);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167560);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167320);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167323);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167324);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167328);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167329);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167621);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/31/2013 00:00', '04/07/2013 00:00', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/30/2013 00:00', '04/06/2013 00:00', 167552);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167552);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'M', 167618);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167618);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/01/2013 00:00', '04/02/2013 00:00', 167419);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167304);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'MOBILE COACH', 'LOWER LEVEL BANQUET FACILITY', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'Y', 'N', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '21', '31', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '08:00', '09:00', 167569);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '16', '21', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'Proust/Knapp Room', 'Poust/Knapp Room', 166990);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '08:00', '16:30', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '12:00', '19:30', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('sponsor_group_code', 'HW05', 'HW01', 167311);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '44', '50', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '16', '14', 167303);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '09:00', '10:30', 167301);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 166249);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'M', 'C', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167843);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'N', 'C', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'LOWER LEVEL BANQUET FACILITY', 'MOBILE COACH', 166532);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'COACH', 'Commons Area', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167559);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167629);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167569);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167570);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167571);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167332);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167304);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167309);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167584);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167586);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167320);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167323);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167328);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167330);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167587);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167614);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '0', '1', 167621);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('open_to_public', 'N', 'Y', 167302);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '8', '10', 167626);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167547);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 167318);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', '1', '0', 167318);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '16', '20', 167318);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'unknown', 'Donor Room', 169762);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('automation', 'N', '0', 168345);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '15:30', '16:00', 167287);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '10', '9', 167325);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '10', '9', 170005);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('projection', '13', '12', 170000);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('room_name', 'CONFERENCE ROOM E1 & E2 & B', 'ACC1', 166278);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '04/03/2013 00:00', '04/04/2013 00:00', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('start_time', '13:30', '12:30', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('end_time', '16:30', '16:00', 167573);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('coach_drive', 'C', 'N', 167565);
Insert into TAB2
   (COLUMN_NAME, OLD_VALUE, NEW_VALUE, AUDIT_KEY)
 Values
   ('drive_id', '03/31/2013 00:00', '04/07/2013 00:00', 167558);
COMMIT;

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

Here is some sample data. Some times there might not be an entry at all (old value or new value)  in the audits(tab2) table for the column name projection. so then we have to take projection from tab1
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39164686
>>Here is some sample data.

Where are the expected results from that data?
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39164715
>>Some times there might not be an entry at all (old value or new value)  in the audits(tab2)

then your existing joins are probably wrong, do you need a left join to the audit table?
right now you have an inner join:

  from blood_drives bd,sites s,blood_drives_audit bda
 where bd.site_code = s.site_code
   and bd.audit_kay = bda.audit_key
SELECT
      drive_date
    , drive_id
    , bd.site_code
    , site_name
    , sum(case when bda.column_name='projection' then NVL(bda.projection,bd.projection) end) projection
    , sum(actual_draw) actual
    , area_rep_no
    , CASE WHEN coach_drive = 'C' THEN 'Coach' WHEN coach_drive = 'M' THEN 'Mini' ELSE 'Inside' END coach_drive
FROM blood_drives bd
INNER JOIN sites s ON  bd.site_code = s.site_code
LEFT JOIN blood_drives_audit bda ON  bd.audit_kay = bda.audit_key
WHERE drive_date >= '01-may-2013' AND drive_date < '16-may-2013'
    AND drive_cancelled IS NULL
GROUP BY drive_date
    , drive_id
    , bd.site_code
    , site_name
    , area_rep_no
    , CASE WHEN coach_drive = 'C' THEN 'Coach' WHEN coach_drive = 'M' THEN 'Mini' ELSE 'Inside' END

Open in new window

0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39187900
thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

649 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