/*****************************************************************************
*
* Filename         - $Workfile:   flight_no2.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 Stored Procedure
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   flight_no2.sql  $  $Revision:   1.8  $
*
* 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/tagtarch/db_ora/db/source/live/procedures/flight_no2.sqv  $
* 
*    Rev 1.8   02 Apr 1998 19:33:52   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.7   15 Jan 1998 12:12:06   tagtrak
* OR: OR11101, TN13, TN15
* CR:
* REV:
* Phase 2C to Phase 3 upgrade plus code review actions and resolving some technical isses.
* 
*    Rev 1.6   24 Oct 1997 11:06:00   tagtrak
* Added PVCS header information
*
****************************************************************************/


PROMPT create or replace procedure flight_no2

create or replace procedure flight_no2 (
	fltid     in  number,
	dcsfltno  out char,
	fltno     out char,
	fltdate   out char
)

as
begin

	/*
	 * - Declare a null fetch exception
	 * - select dcs_flight_no, flight_no and flight_date from the flight
	 *   table where the flight_id is equal to fltid.  If no data found
	 *   then initialise variables, if null fetch then initialise
	 *   dcsfltno to '-'.
	 */

	declare
		NULL_FETCH exception;
		pragma exception_init(NULL_FETCH, -1405);

	begin
		select
			dcs_flight_no,
			flight_no,
			flight_date
		into
			dcsfltno,
			fltno,
			fltdate
		from
			flight
		where
			flight_id = fltid;

	exception
		when NO_DATA_FOUND then
			dcsfltno := '-';
			fltno    := '-';     --NOT NULL field
			fltdate  := '-';     --NOT NULL field
		when NULL_FETCH then 
			dcsfltno := '-';
	end;
end flight_no2;
/
