/*****************************************************************************
*
* Filename         - $Workfile:   map_class.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history.
* Last Update      - See revision history.
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 
*
* Design Spec
* Section          - 
*
* Contents         - Live Schema Stored Procedure
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2006
*
*****************************************************************************/

PROMPT create or replace function map_class

CREATE OR REPLACE FUNCTION map_class(p_airline_code IN class_list.airline_alpha_code%TYPE,
                                     p_ticket_class IN class_list.ticket_class%TYPE)
  RETURN class_list.cabin_class%TYPE IS
  l_cabin_class class_list.cabin_class%TYPE;
BEGIN
  SELECT cabin_class
    INTO l_cabin_class
    FROM class_list
   WHERE airline_alpha_code = p_airline_code
     AND ticket_class       = p_ticket_class;
  RETURN l_cabin_class;
EXCEPTION
  WHEN no_data_found THEN
    RETURN p_ticket_class;
END map_class;
/