/*****************************************************************************
*
* Filename         - $Workfile:   get_dcs_flight_no.sql  $
*
*      Name				
Date				
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Contents         - Live Schema Stored Procedure
*
* Language         - Oracle PL/SQL
*
* Classification   - Commercial In Confidence
*
* (c) Ultra Electronics Limited 2001
*
*****************************************************************************/

/****************************************************************************
*
* Function				- get_dcs_flight_no
*
* Description	- This Function return the _flight_no used for BPMS 
*
*****************************************************************************/
CREATE OR REPLACE FUNCTION
get_dcs_flight_no
(
        fltno  IN flight.flight_no%type,
     dcsfltno  IN flight.dcs_flight_no%type
)
RETURN varchar2 IS
     ret    flight.dcs_flight_no%type;
BEGIN
        -- equiv  to
        --   decode(rtrim(nvl(dcsfltno,'-')),'-',replace(fltno,' ',''),dcsfltno);
        if dcsfltno = '-' or dcsfltno is null then
           ret := replace(fltno,' ','') ;
	else
	   ret := dcsfltno;
	end if;


        RETURN ret;
END;
/
