/*********************************************************************************
*         - $Workfile:   event_logging.sql  $
*
*                     Name: Yomi Kogbe    Date: 03/05/00  Version1.0     CR Number:14954
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          -
*
* Contents         - Live Schema View
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
PROMPT Creating view event_logging_v1;
CREATE OR REPLACE FORCE VIEW event_logging_v1
(
    flight_no,
    flight_date,
    flight_direction,
    event_key,
    event_duration,
    event_description,
    log_time,
    location_description,
    loginname,
    agent_code,
    end_log_time,
    end_location_code,
    end_loginname,
    end_agent_code
) as
select 
        e.flight_no,
        e.flight_date,
        e.flight_direction,
        e.event_key,
        e.event_duration,
        e.event_description,
        e.log_time,
        l.location_description,
        t.loginname,
        t.agent_code,
        e.end_log_time,
        le.location_description,
        te.loginname,
        te.agent_code
 from   flight_events e, location l, location le, tagtrak_users t, tagtrak_users te  
 where  e.user_id = t.user_id 
   and  e.location_code = l.location_code
   and  e.end_user_id =  te.user_id (+)
   and  e.end_location_code = le.location_code (+);

