/*****************************************************************************
*
* Filename         - $Workfile:   lba_info_v1.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         -  View creation/replacement of view lba_info_v1.
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1999
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   lba_info_v1.sql  $  $Revision:   1.2  $
*
* 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:   /pvcsarch/db_ora/db/source/live/views/lba_info_v1.svl  $
* 
*    Rev 1.2   21 Jun 2001 15:37:18   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.1   31 Jan 2000 15:07:54   tagtrak
* OR:
* CR: 14402
* REV: 
* San Francisco Core Product Merge
* Neil Hilier
* 
*    Rev 1.0   07 May 1999 15:03:08   tagtrak
* OR:
* CR: 13934
* REV:
* Oracle 8.
* FASL gate width change to Oracle char(5).
* LBA interface (excluding archive and backup).
* Clean build fixes from DB v1.0.0 (arch schema onward_flight &flight_dests).
* Change of expected FASL flight_no format.
* 
* Peter Dawson, 7th May 1999
* 
* 
*
****************************************************************************/

PROMPT Creating view LBA_INFO_V1 ;

CREATE OR REPLACE FORCE VIEW LBA_INFO_V1 (
	FLIGHT_ID, NAME, SEAT, SEQ, TRANSACTION, 
	TIME, 
	ERROR_TYPE, 
	ERROR_MESSAGE
)
as
	select
		F.FLIGHT_ID, LI.PAX_NAME, LI.SEAT, LI.SEQ_NO, LI.TRANSACTION,
	 	to_char(LI.INSERT_DATE, 'HH24:MI'),
		decode(( to_char( sign( LI.ERROR_ID ), 'S0' ) || substr( E.ERROR_DESCRIPTION, 1, 8 )), 
			'-1Warning ','W',
			'+0No Error','S',
			'F'
		),
		E.ERROR_DESCRIPTION
	from 
		FLIGHT F, LBA_INFO LI, ERROR E
	where
		LI.ERROR_ID = E.ERROR_ID and
		LI.FLIGHT_ID = F.FLIGHT_ID (+)    /* Outer join req'd to allow for Unknown Flight cases */
;
