/*****************************************************************************
*
* Filename         - $Workfile:   is_connection_valid.sql  $
*
*                     Name              Date      Version     CR Number
*                     Yomi Koge         12/08/02     1.0        15644
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - ULTRATRAK(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, 2002
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   is_connection_valid.sql  $  $Revision:   1.0  $
*
* 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/procedures/is_connection_valid.sqv  $
*
*****************************************************************************/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 *                                                                         * 
 * Function to check the validity of a connection type and to return the   * 
 * correct value to insert into the database                               * 
 *                                                                         * 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
PROMPT CREATE OR REPLACE FUNCTION is_connection_valid 

CREATE OR REPLACE
FUNCTION is_connection_valid 
   (vtype   IN  connection_configuration.connect_type%TYPE,
    mapped  OUT connection_configuration.mapping%TYPE
   ) RETURN BOOLEAN IS
  term_info char(6);
BEGIN
    -- map the input connection type to its configured corresponding value
    SELECT connect_type, mapping 
      INTO term_info, mapped
      FROM connection_configuration
    WHERE connect_type = vtype;

    RETURN TRUE;
EXCEPTION
    WHEN NO_DATA_FOUND THEN
      RETURN FALSE;
END is_connection_valid;
/
