/*****************************************************************************
*
* Filename         - $Workfile:   bag_v2.sql  $
*
*                     Name              Date      Version     CR Number
* 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
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   bag_v2.sql  $  $Revision:   1.3  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /shared/pvcs/aisarch/db_ora/db/source/live/views/bag_v2.svl  $
* 
*    Rev 1.3   12 Sep 2002 17:55:06   tagtrak
* OR:
* CR: 15644
* DESC: BA BRS Segregation changes
* 
*    Rev 1.2   21 Jun 2001 15:36:42   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.1   02 Apr 1998 19:47:42   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.0   22 Oct 1997 16:50:38   tagtrak
* OR:
* CR:
* REV:
* Initial check-in
*
****************************************************************************/

PROMPT Creating view   BAG_V2   

CREATE OR REPLACE FORCE VIEW   BAG_V2   (FLIGHT_ID  , FLIGHT_NO  , FLIGHT_DATE  , PAX_ID  , PAX_INITIALS  , PAX_SURNAME  , PAX_CLASS  , BAG_TAG  , ULD_NO  , AUTHORITY_TO_LOAD_DCS  , AUTHORITY_TO_LOAD_BRS  , UNASSOCIATED_BAG  , BAG_DESTINATION  , BAG_EXCEPTION  , BAG_SOURCE_INDICATOR  , LOADED_STATUS  , BAG_SEQUENCE_NO  , TIME_LOADED  , TIME_BAG_STORED  , DELETE_MARKER  , BAG_TAG1  , BAG_TAG2A  , BAG_TAG2B  , BAG_TAG3  , BAG_TAG3A , LOCATION_CODE  , SCANNER_ID  , ULD_FLIGHT_ID  , PAX_SEQUENCE_NO, SECURITY_CLEARANCE_STATUS, CONNECTION_TYPE , BAG_ID
) as
  select
 flight.flight_id,  flight.flight_no,  flight.flight_date,  pax.pax_id,  pax.pax_initials,  NVL(pax.pax_surname,'NOTSUPPLIED'),  pax.pax_class,  bag.bag_tag,  bag.uld_no,  bag.authority_to_load_dcs,  bag.authority_to_load_brs,  bag.unassociated_bag,  bag.bag_destination,  bag.bag_exception,  bag.bag_source_indicator,  bag.loaded_status,  bag.bag_sequence_no,  to_char(bag.time_loaded, 'HH24:MI'),  to_char(bag.time_bag_stored, 'HH24:MI'),  bag.delete_marker,  bag.bag_tag1,  bag.bag_tag2a,  bag.bag_tag2b,  bag.bag_tag3,  lpad(bag.bag_tag3,6,'0'), bag.location_code,  bag.scanner_id,  bag.uld_flight_id,  pax.pax_sequence_no, bag.security_clearance_status, bag.connection_type, bag.bag_id
from  bag, pax, flight
where pax.pax_id = bag.pax_id  and  flight.flight_id  = pax.flight_id;

